Lurker News
Hi HN

It also supports percentages, dates and variables.
I've been working on this alone for a few years now, so would love to get some feedback.

Comments (239) 97 threads

Show all comments

Showing thread 47 of 97

vhanda3 replies#
This is awesome.

Minor bug report -
* 5 feet 8 inches to centimeters -> -171.72 cm
* 5 feet 8 inches to meters -> -0.7272 m
* 5 feet 8 inches to cms -> doesn't work
The conversion seems wrong in the case of cms, and I'm not sure why it's always negative.

defrost#
"to" is a subtraction operation, not a convert to cue.

As in (distance from) 30 to 50 (is 20 == 50 - 30 )

Spare_account#
After reading the sibling comments to mine, I've worked out what it is doing.

> * 5 feet 8 inches to centimeters -> -171.72 cm
As @defrost said, the 'to' operator instructs NumPad to calculate the distance from the unit before 'to' and the unit after 'to'.
To the nearest mm, 5 feet 8 inches = 172.72cm
It appears that NumPad is defaulting to a value of '1' where no value is specified, so it is calcuating the distance BACK from '5 feet 8 inches' TO '1 centimeters'.
It correctly responds with -171.72, which is 1cm less than 172.72.
> * 5 feet 8 inches to meters -> -0.7272 m
Same as above, except the calucation is the distance back from '5 feet 8 inches' TO '1 metres'.*
If you use the operator 'in', NumPad calculates the answer correctly:
5 feet 8 inches in metres -> 1.7272 m