News for hackers. Stuff that matters.
Re:The trouble with 'floor' and 'ceil' by davvid on Thursday January 07, 2016 @02:02AM (#10856459)
I think another contributor to the author's surprise is this subtle detail about the behavior of Python's `print` statement. From the docs[1]:

Python only prints a decimal approximation to the true decimal value of the binary approximation stored by the machine. If Python were to print the true decimal value of the binary approximation stored for 0.1, it would have to display

    >>> 0.1
    0.1000000000000000055511151231257827021181583404541015625

That is more digits than most people find useful, so Python keeps the number of digits manageable by displaying a rounded value instead

    >>> 0.1
    0.1
[1] https://docs.python.org/2/tutorial/floatingpoint.html
Re:The trouble with 'floor' and 'ceil' by mortoray on Thursday January 07, 2016 @02:29AM (#10856529)
Python actually seems to show a much higher precision than other languages (higher than C's printf default I belive).

Interesting is that print can show an exact representation of any floating point value, but of course 0.1 can't be represented exactly.