This topic has been closed. No new entries allowed.
Reason: You can now post comments on articles on Dev Opera
You need to be logged in to post in the forums. If you do not have an account, please sign up first.
Why I Love ECMAScript 4: Real Decimals
Have you ever noticed how calculations involving floating point numbers in JavaScript and other languages can sometimes turn out inaccurately, due to it's use of Binary floats? ECMAScript 4 fixes this by allowing us to use real decimals if desired - in this article, Chris Pine explores the topic.( Read the article )
Developer Relations Manager
Editor, dev.opera.com and labs.opera.com
Developer Relations Manager
Editor, dev.opera.com and labs.opera.com
Originally posted by Feedback:
Superfluous precision
THE reminder sent by UK phone company BT to a client of Derek Woodroffe stated: "This email is to advise you of an outstanding amount of £87.510000000000005 relating to the above BT Business Broadband account. Please pay your bill promptly as failure to do so could lead to a late payment charge of £10." Woodroffe is suggesting his client writes to his bank requesting a "much wider cheque book" because of the difficulty of fitting in the amount to be paid.
Meanwhile, Jonathan Privett tells us that his local Caffè Nero coffee shop in south London has posted in its window a licence from Lambeth council permitting the shop to have seating outside the premises, so long as the chairs leave 3.4500000000000002 metres of pavement free for pedestrians. Hopefully Caffè Nero is in possession of a sufficiently accurate tape measure.
The moral seems clear: If you don't want to be lampooned by a major international magazine, you better switch to ECMAScript 4.
========================================================================
Originally posted by JeroenH:
Does ES4 really work in the latest alpha (=9.5 beta)?
I tried this:<script type="application/ecmascript;version=4"> { use decimal; var a = 0.1; // a is a decimal var b = 0.2; // b is a decimal var c = a + b; // c is a decimal (0.3) alert(c); } </script>, but it did not work...
