thats is impossible
i just executed this in java:

double src = -0.58;
return new Double(src*100);

the return was:
(java.lang.Double) -57.99999999999999

rhino is just java its not that the engine does something to it.

again it is how floating point works, it is not that it can hold 0.58
because it cant
because that numer is not exactly stored like that and yes it is very
precise because
the offset is only
-0.00000000000001

which is a very small number...

If you want accurate "floatingpoint" numbers then you have to use BigDecimal

which is pretty much 2 ints 1 with the number and 1 with the scale, where
the point is.

problem is that rhino internally works with doubles (as ofcourse does all
the browser js implementations)

johan


On Thu, Sep 18, 2008 at 9:11 AM, <[EMAIL PROTECTED]> wrote:

> On Sep 17, 4:26 pm, "Johan Compagner" <[EMAIL PROTECTED]> wrote:
> > thats how floating points works..
> >
>
> I don't agree. If I do the same computation in Java I get -58 as the
> result.
>
> Inaccuracies only occur in Floating Point calculations when the number
> of digits is high. Here we are only dealing with 2 significant digits
> which easily fits within a 64-bit floating point binary number.
> _______________________________________________
> dev-tech-js-engine-rhino mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
>
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to