Re: [Full-disclosure] Firefox 2.0.0.7 has a very serious calculation bug



Michal

I don't get the same from C-style double arithmetics. Could you
provide a sample code that you believe should show the same behavior?

On 9/28/07, Michal Zalewski <lcamtuf@xxxxxxxx> wrote:
On Fri, 28 Sep 2007, carl hardwick wrote:

javascript:5.2-0.1
Firefox 2.0.0.7 result: 5.1000000000000005 (WRONG!)

This is a proper behavior of IEEE 754 64-bit double float, which, IIRC, is
precisely what ECMA standard mandates.

You will get the same from any C-style 'double' arithmetics.

Internet Explorer 7 result: 5.1 (OK)

They use a marginally higher precision. Now try 5.002-.001 - chances are,
you will get 5.00999...

Neither is a "very serious calculation bug". Javascript does not guarantee
- and nowhere actually delivers - arbitrary GMP-style precision.

/mz

_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.grok.org.uk/full-disclosure-charter.html
Hosted and sponsored by Secunia - http://secunia.com/


_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.grok.org.uk/full-disclosure-charter.html
Hosted and sponsored by Secunia - http://secunia.com/



Relevant Pages

  • Re: status of quadruple precision arithmetic in g95 and gfortran?
    ... 128 bits floating point arithmetics. ... In the case of extended precision ... Several architectures include hardware support for 128-bit floating point by combinations of instructions. ...
    (comp.lang.fortran)
  • Re: limit decimals
    ... Not all computations in MATLAB are done in double precision. ... FORMAT does not affect how MATLAB computations are done. ... You can verify that arithmetics in single precision is faster than ...
    (comp.soft-sys.matlab)
  • Re: status of quadruple precision arithmetic in g95 and gfortran?
    ... Computing with quad precision is really slow by the fact that it is ... 128 bits floating point arithmetics. ... In the case of extended precision ...
    (comp.lang.fortran)