Posts

Showing posts from June, 2009

First Wave Robot

I took advantage of the fact that some wave developers were passing by our office and wrote a wave robot during a jam session. This robot monitors what is being typed and makes it easy to convert to different units. If you type "100kg (? lbs)" it will replace the ? with the correct value of 220 after you type the closing parenthesis, for example. I went a bit further and tried to be sensible with the significant figures. I didn't want it say '220.462262 lbs. So I examine the number of significant figures from the original number and try to duplicate it in the result. If you say "100 kg" it'll put "220 lbs". If instead you enter "100.0 kg" it'll put "220.5 lbs". Test revealed, however, that this wasn't good enough. If I put in "1 inch" in would convert this to "3cm", a 18% error. I put in an extra rule to increase the precision if the error was greater than 10%, which got these corner case...