1. 14

  2. 2

    On the story of NaN, it’s kind of interesting what R has done with it. It uses a special NaN pattern to represent NA (not applicable). So they are trying to make a distinction between NaN-the-erroneous calculation (e.g. 0/0) and NaN-the-missing-value.

    The funny thing is what this special NaN pattern they chose is: Robert Gentleman’s birthday.

    1. 1

      I’m a little surprised the x87 is even involved here - doesn’t targeting “modern” x86 usually involve using the scalar SSE instructions since they have behave more predictably than x87 does?

      1. 3

        Even if your compiler emits exclusively SSE instructions for actual arithmetic, the de-facto-standard calling conventions on x86 (but not x86-64), cdecl and stdcall, return floating-point values from functions by sticking them onto the x87 FPU stack. So there will still be a handful of x87 instructions emitted solely to push/pop the FPU stack, even if no other x87 features are used, which seems to be what’s happening here. That convention was set ages ago and changing it would break ABI compatibility.

        1. 1

          Interesting, thank you!