News for hackers. Stuff that matters.
Re:Be careful with JS numbers by CamperBob2 on Sunday January 13, 2013 @04:34PM (#5051941)
C/C++:

   printf("%lf\n", 1000000 * 8.2);
   8200000.000000
Here, printf() is doing the necessary rounding to hide the fact that 8.2 isn't exactly representable. It's interesting that other languages don't do something similar when outputting a float to text.
Re:Be careful with JS numbers by pindi on Sunday January 13, 2013 @05:36PM (#5052172)
They do, you just have to request it:

    //Python
    >>> repr(1000000 * 8.2)
    '8199999.999999999'
    >>> "%lf" % (1000000 * 8.2)
    '8200000.000000'