Hacker News new | ask | show | jobs
by piadodjanho 2539 days ago
In the paper "Do Developers Understand IEEE Floating Point" the authors surveys phd student and faculty members from computer science and found out that your observation is true: most people don't know how fp works.

They have the survey online at [1] in case you want to see how much you know about fp behavior.

[1] http://presciencelab.org/float

1 comments

That was a waste of time: 6 pages of questions, and instead of "grading" it and letting me know where I stand on FP, it says "Thanks for the gift of your time".
Likewise!

FYI the actual paper is https://ieeexplore.ieee.org/document/8425212 and you can get the PDF here: http://pdinda.org/Papers/ipdps18.pdf

Interestingly, they got one of their own answers wrong.

The question is:

    if a and b are numbers, it is always the case that (a + b) == (b + a)
and their notes on it:

    Is a simple statement involving the commutativity over addition true for floating point? Generally, floating point arithmetic follows the same commutativity laws as real number arithmetic.
They make it clear in their notes that "are numbers" includes infinities but not NaNs. Now consider the case where a = inf and b = -inf. Then inf + (-inf) is NaN, and (-inf) + inf is NaN, and NaN != NaN.

    >>> a = float('inf')
    >>> b = float('-inf')
    >>> a + b == b + a
    False
Nice catch.

> They make it clear in their notes that "are numbers" includes infinities but not NaNs.

This is definitely not very clear on the form, thought.

Sorry for tricking you into giving real data for the researchers LOL.

Another comment pointed out to the paper with the answers.

A great resource to learn about the FP corner cases is the great Random ASCII blog:

https://randomascii.wordpress.com/category/floating-point/