Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


[web] Is JavaScript floating-point math deterministic?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Gamer Gamester   Members   -  Reputation: 136

Like
0Likes
Like

Posted 30 August 2011 - 12:45 AM

Is JavaScript floating-point math deterministic across modern browsers and OSes?

I haven't been able to find much info on this... though I'm getting the impression that the answer is an unfortunate "no".

Sponsor:

#2 Hodgman   Moderators   -  Reputation: 30989

Like
0Likes
Like

Posted 30 August 2011 - 01:21 AM

According to the spec, they seem to dictate compliance with IEEE 754, which should give the usual determinism caveats...

The Number type has ... values, representing the double precision 64-bit format IEEE 754 values as specified in the IEEE Standard for Binary Floating-Point Arithmetic...
This procedure corresponds exactly to the behaviour of the IEEE 754 ―"round to nearest" mode...
The result of a floating-point multiplication is governed by the rules of IEEE 754 binary double-precision arithmetic... The result of division is determined by the specification of IEEE 754 arithmetic...
etc...

...but, then again, when did browsers ever faithfully implement common specifications? Posted Image
You can see the list of dialects and the version of the spec they purport to implement on wikipedia.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS