No time is Not a Number
-
It's not a clever WTF, but when you enter a comment on soundcloud and it's not a timed on, they print (see two first comments):
I can imagine null, undefined, perhaps even Nan, but Infinity.Nan.Nan?
-
Infinity / 60 = Infinity.
Infinity % 60 = NaN.
-
@configurator said:
Infinity / 60 = Infinity.
Infinity % 60 = NaN.And of course,
typeof NaN === 'number'
-
But why did they choose "Infinity" to represent a comment without a time? Undefined, null, false, -1, {}, "", almost anything is better than Infinity. And no-one noticed so far. Anyway.
-
@TGV said:
But why did they choose "Infinity" to represent a comment without a time? Undefined, null, false, -1, {}, "", almost anything is better than Infinity. And no-one noticed so far. Anyway.
My theory is that it's just a quirk of some calculation they do. IEEE floating points are weird like that.