Back to News
Advertisement
Advertisement

⚡ Community Insights

Discussion Sentiment

50% Positive

Analyzed from 112 words in the discussion.

Trending Topics

#nan#inf#hypot#https#com#number#cathetus#infinite#don#need

Discussion (5 Comments)Read Original on HackerNews

aragilarabout 1 hour ago
You don't need NaN (or Inf) to have unexpected behaviour with floats and naive loops in lua, using 1e52 is enough. Conflating floating point and integers (independent of encoding) is always a bit of a trap.
jjgreenabout 3 hours ago

      hypot(Inf, NaN) == Inf
made me laugh out loud ...
Someoneabout 2 hours ago
That’s straight from the standard. https://en.cppreference.com/c/numeric/math/hypot: “if one of the arguments is ±∞, hypot returns +∞ even if the other argument is NaN”

⇒ I expect this choice got careful consideration. (Edit: in the end, the reasoning still could have been “unfortunately, existing implementations do it this way; we’ll begrudgingly follow them”)

jjgreenabout 1 hour ago
Indeed, and makes you realise that NaN is not "not a number" but rather "not a particular number", if one cathetus is infinite then the hypotenuse must be infinite whatever the other cathetus is ...
ColinWrightabout 2 hours ago