Click here to Skip to main content
15,900,110 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: What the NaN? Pin
Richard MacCutchan2-Oct-16 22:41
mveRichard MacCutchan2-Oct-16 22:41 
GeneralRe: What the NaN? Pin
Sander Rossel2-Oct-16 22:51
professionalSander Rossel2-Oct-16 22:51 
GeneralRe: What the NaN? Pin
Richard MacCutchan2-Oct-16 22:54
mveRichard MacCutchan2-Oct-16 22:54 
GeneralRe: What the NaN? Pin
Sander Rossel2-Oct-16 23:20
professionalSander Rossel2-Oct-16 23:20 
GeneralRe: What the NaN? Pin
Richard MacCutchan2-Oct-16 23:30
mveRichard MacCutchan2-Oct-16 23:30 
GeneralRe: What the NaN? Pin
Sander Rossel3-Oct-16 6:00
professionalSander Rossel3-Oct-16 6:00 
GeneralRe: What the NaN? Pin
Richard MacCutchan3-Oct-16 6:21
mveRichard MacCutchan3-Oct-16 6:21 
GeneralRe: What the NaN? Pin
Theraot4-Oct-16 1:33
Theraot4-Oct-16 1:33 
It is not just a C#, it is IEEE 754

And this is how you represented:

7ff0 0000 0000 000016   = Infinity
fff0 0000 0000 000016   = −Infinity
7fff ffff ffff ffff16   = NaN


Those first 12 bits correspond to the sign and exponent, and the values 7ff and fff are reserved constants with special meaning.

Why? I don't freaking know, I didn't invent IEEE 754. But anywhere you find double it is like that because it is standard, and it is even implemented in the CPU.

It is very easy to show it is not C#, see this JSFiddle[^].

Does it make mathematical sense? No. A number system that has a representation for not-a-number makes no sense.

---

Although I can argue that a number system with 1/0 = Infinity is possible, it would be a two-point compactification[^] of the real numbers to include -Infinity and Infinity*. Another system with 1/0 = Infinity is the Rieammn Sphere**, but that number system has only one Infinity and include the complex numbers.

*: To be clear, that means that you create a topological space where the infinite number line is embedded by a projection in a finite segment. Then the points at the extremes of the segment can't ever be reached, there is no real number low or high enough to reach those points. Then you label then "-Infinity" on the negative side and "Infinity" on the positive side. Clearly those points aren't real numbers, and they break traditional algebra, but they are numbers. Why would you want them? I don't know.

**: But I know for the Riemman Spehre, you can extend the real numbers to add the complex infinity point. This is embedding the complex plane in the surface of a unit sphere, such that the opposite point from 0 is never reached by any complex number. Then you label that point "Complex Infinity". Then you go to say that 1/0 = Complex Infinity, and 1 / Complex Infinity = 0 - now you can divide by infinity and solve integrations the old way. Yet, it also breaks algebra. Of course, this is problematic, and mathematicians left the idea in favor of Limits. The modern well-behaved solution (that doesn’t break algebra) is Hyperreals.
GeneralRe: What the NaN? Pin
Herbie Mountjoy4-Oct-16 2:25
professionalHerbie Mountjoy4-Oct-16 2:25 
GeneralRe: What the NaN? Pin
Richard MacCutchan4-Oct-16 3:42
mveRichard MacCutchan4-Oct-16 3:42 
GeneralRe: What the NaN? Pin
Richard MacCutchan4-Oct-16 6:13
mveRichard MacCutchan4-Oct-16 6:13 
GeneralRe: What the NaN? Pin
Sander Rossel4-Oct-16 8:02
professionalSander Rossel4-Oct-16 8:02 
GeneralRe: What the NaN? Pin
Fly Gheorghe4-Oct-16 5:52
Fly Gheorghe4-Oct-16 5:52 
GeneralRe: What the NaN? Pin
Richard MacCutchan4-Oct-16 6:13
mveRichard MacCutchan4-Oct-16 6:13 
GeneralRe: What the NaN? Pin
Manfred Rudolf Bihy3-Oct-16 8:19
professionalManfred Rudolf Bihy3-Oct-16 8:19 
GeneralRe: What the NaN? Pin
Sander Rossel3-Oct-16 8:30
professionalSander Rossel3-Oct-16 8:30 
GeneralRe: What the NaN? Pin
Gary R. Wheeler2-Oct-16 11:42
Gary R. Wheeler2-Oct-16 11:42 
GeneralRe: What the NaN? Pin
Richard MacCutchan2-Oct-16 22:39
mveRichard MacCutchan2-Oct-16 22:39 
GeneralRe: What the NaN? Pin
Slacker0073-Oct-16 1:31
professionalSlacker0073-Oct-16 1:31 
GeneralRe: What the NaN? Pin
den2k882-Oct-16 20:53
professionalden2k882-Oct-16 20:53 
GeneralRe: What the NaN? Pin
StatementTerminator4-Oct-16 6:01
StatementTerminator4-Oct-16 6:01 
GeneralRe: What the NaN? Pin
BillWoodruff2-Oct-16 6:25
professionalBillWoodruff2-Oct-16 6:25 
GeneralRe: What the NaN? Pin
Midi_Mick2-Oct-16 7:41
professionalMidi_Mick2-Oct-16 7:41 
GeneralRe: What the NaN? Pin
Sander Rossel2-Oct-16 8:47
professionalSander Rossel2-Oct-16 8:47 
GeneralRe: What the NaN? Pin
Mladen Janković2-Oct-16 10:11
Mladen Janković2-Oct-16 10:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Straw Poll

Were you affected by the geomagnetic storms this past weekend?
Communication disruptions, electrified pipes, random unexplained blue-screens in Windows - the list of effects is terrifying.
  Results   482 votes