+ 2
How do computers store the value Infinity since computers store things in binary?
I noticed that Java and JS have the values Infinity and -Infinity , so I was wondering how do computers store the value Infinity since computers store things in binary?Is there perhaps a specific bit?
2 odpowiedzi
+ 6
"Though it is impossible for a computer to literally represent the value of infinity in memory, the Java "double" and "float" data-type reserves two slots in its address range that are understood by the computer to refer to positive and negative infinity." -Amber D. Walker
For more info check this blog post:
https://www.techwalla.com/articles/how-to-use-infinity-in-java
+ 2
Considering that Infinity value is expected in IEEE 754, i think that it is represented as the standard set, with:
Exponent: all 1s
Mantissa: all 0s
Sign bit: 1 if negative, 0 if positive normally