what
@jimfl I think this is because of Erlang‘s Term Comparisons and the order is:
number < atom < reference < fun < port < pid < tuple < map < nil < list < bit string
https://www.erlang.org/doc/system/expressions.html#term-comparisons
n-ah, NaN and 0 are both numbers. i think it's a leaking implementation. i imagine it being implemented something like (pseudocode):
min() = if a > b then a else b
max() = if a > b then b else a
so, comparison with nan is always false, if i remember correctly hence it will always hit the else branch. it's easy to test: try changing the argument order.
@rogerlipscombe @orsinium @fluffel Yeah, I just sort of whipped out NaN on a whim and it “worked.” I was surprised there was nothing in the docs for it. It was probably a mistake to define it