[TxMt] Re: rounding bug in Math bundle...

Timothy Bates timothy.c.bates at gmail.com
Tue Dec 1 18:06:41 UTC 2009


math.tmBundle is using bc which is a powerful arbitrary precision  
programmable math engine (man bc)

I guess php et al. are rounding their results. I think bc can use  
BC_SCALE_MAX to force that, or the bundle could be re-written

All this being said: I think the bundle could use some love.

I'd very much appreciate a bundle that could add numbers in currency  
formats (i.e., strip off units and stick them back onto the answer. So  
this would work:
   £2 + .34

I'd also like the bundle to replace anything after an existing =
so  "2 + 2= 4" would not cause an error. That would allow editing of  
the inputs without having to also delete earlier results each time.

best wishes,
tim




On 1 Dec 2009, at 4:31 PM, Ale Muñoz wrote:

> I expected something akin to what every decent tool out there  
> produces:
>
> $ ruby -e "puts (72/2.54)*2.54"
> 72.0
>
> $ php -r "echo((72/2.54)*2.54);"
> 72
>
> $ perl -e "print ((72/2.54)*2.54)"
> 72
>
> heck, even JavaScript gets it right...
>
> Funnily enough, the "Send Line to Google Calculator" on the same
> bundle gets it right...



More information about the textmate mailing list