+ 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?

21st Aug 2018, 8:52 PM
Shuaib Nuruddin
Shuaib Nuruddin - avatar
2 Réponses
+ 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
21st Aug 2018, 9:24 PM
Eduardo Petry
Eduardo Petry - avatar
+ 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
21st Aug 2018, 9:37 PM
DonPietro Cavastano
DonPietro Cavastano - avatar