logoalt Hacker News

magicalhippotoday at 10:14 AM1 replyview on HN

I also like how a / b can result in infinity even if both a and b are strictly non-zero[1]. So be careful rewriting floating-point expressions.

[1]: https://www.cs.uaf.edu/2011/fall/cs301/lecture/11_09_weird_f... (division result matrix)


Replies

StilesCrisistoday at 12:12 PM

Anything that overflows the max float turns into infinity. You can multiply very large numbers, or divide large numbers into small ones.

show 1 reply