[Shootout-list] floating point rounding

James McIlree ovrskeek@mac.com
Thu, 31 Mar 2005 01:30:32 -0800


	Indeed, Java changes, but three variants of Lisp I tried did not.

	This seems amazingly byzantine, I'm surprised numerically inclined
types tolerate it!

Java:

0.011 0.01
0.012 0.01
0.013 0.01
0.014 0.01
0.015 0.02
0.016 0.02
0.017 0.02
0.018 0.02
0.019 0.02

Lisp:

0.011 0.01
0.012 0.01
0.013 0.01
0.014 0.01
0.015 0.01
0.016 0.02
0.017 0.02
0.018 0.02
0.019 0.02



On Mar 31, 2005, at 1:01 AM, Daniel South wrote:

> James McIlree wrote:
> | I ran some quick tests with what I had available, I admit
> | its not great coverage :-).
> |
> | It looks like C, Ruby, and Python round up at .5, Java and
> | Lisp round up at .6. It would be interesting to see what some of
> | the other languages choose to do.
> |
> Actually, that's a round to even. If you use 0.011 -> 0.019, you should
> find that 0.015 rounds to 0.02 for Java and Lisp.
> Java defaults to round to even, to round up you'll have to use 
> something
> like "import java.math.BigDecimal" and configure it.
>
> Daniel South
>
>
> _______________________________________________
> Shootout-list mailing list
> Shootout-list@lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/shootout-list
>