NaN gates in julia? (from SIGBOBIK)


Sigbovik produces every year a new edition, where they publish funny academic stuff. One article in the 2019 edition talks about the NaN gates, citing the document:

People who work with real numbers are often taught that the number NaN is propagated through all expressions that use it (e.g. NaN−1 = NaN), like some kind of GNU Public Licensed number. This is a misconception. We already saw in the beautiful identities above that some expressions involving NaN do not result in NaN, like 1^NaN = 1 and compound(NaN, 0) = 0. But it is also the case that 1^inf = 1 and compound(inf, 0) = 0. Are there mathematical functions that distinguish between NaN and inf?
It turns out that there are! For example, the functions minNum and maxNum ([IEEE 754-2008, 5.3.1, p19]) take two arguments and return the min and max, respectively. They have the special, distinguished property that “if exactly one argument is NaN, they return the other. If both are NaN they return NaN.”

he implementation on julia of minNum and maxNum is, i think, the functions Base.min and Base.max, but, to my dismay, this happened:

julia> min(NaN,1)

My work is completely stopped because of this, and i blame on the compiler :smile: ,
Anyway, is this ok?, i don’t care if it gets solved,it seems weird,but it can have some arcane uses and can improve the compliance with the floating point standard



There is a rather long discussion of that issue here:



Also I heartily recommend the video accompanying the NaN gate paper: