Wednesday, February 22, 2012

Re: GWT strange code generation on float numbers

I don't think javascript is immune to this ...

http://stackoverflow.com/questions/588004/is-javascripts-math-broken

I just tried .1 + .2 at jsbin and got 0.30000000000000004

From the OP I assume the substitution for var f is not just a string
replacement; the literal is evaluated and during the evaluation the
number gets changed to something IEEE can handle.

Steve

On Feb 20, 3:10 pm, Andrey Korzhevskiy <a.korzhevs...@gmail.com>
wrote:
> .000001 can be expressed in JS floating number. The thing is not in IEEE
> and runtime number representation. The thing is in that literal constant
> should not be changed.
> I mean if in Java code I see   'float myNum = 0.000001', I expect to see it
> in generated JS as 'var myNum = 0.000001'

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment