logoalt Hacker News

jjgreentoday at 8:45 AM1 replyview on HN

      hypot(Inf, NaN) == Inf
made me laugh out loud ...

Replies

Someonetoday at 9:50 AM

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”)

show 1 reply