Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9
It is Mathematically undefined, but here's a quote from StackOverflow as to why it is Infinity: "Java's float and double types, like pretty much any other language out there (and pretty much any hardware FP unit), implement the IEEE 754 standard for floating point math, which mandates division by zero to return a special "infinity" value. Throwing an exception would actually violate that standard." Link to IEEE_754: https://en.m.wikipedia.org/wiki/IEEE_754 So, it's sort of just a standard to represent it as a special Infinity rather than some other NaN value or an exception.
26th Oct 2017, 12:14 AM
Rrestoring faith
Rrestoring faith - avatar