In Java, what does NaN mean?
I have a program that tries to shrink a double
down to a desired number. The output I get is NaN
.
What does NaN
mean in Java?
java nan
add a comment |
I have a program that tries to shrink a double
down to a desired number. The output I get is NaN
.
What does NaN
mean in Java?
java nan
There is a good description of NaN and of the common pitfalls when using NaN in Java: ppkwok.blogspot.co.uk/2012/11/…
– Phil
Nov 25 '12 at 1:56
If you are asking "what good is NaN?" in Java (or any other language), I can give you a use case where it is very handy: when I have a 2-D array of floats, but my calculation has no meaningful value for some portion of that 2-D array, I'll fill that value with "NaN". This can be used to signal downstream users of my calculation (such as when it is turned into a raster image) "don't pay attention to the value at this point". Very useful!
– Dan H
Jun 6 '18 at 13:36
BTW, what -- exactly -- does it mean to "shrink" a double? Curious...
– Dan H
Jun 6 '18 at 13:38
add a comment |
I have a program that tries to shrink a double
down to a desired number. The output I get is NaN
.
What does NaN
mean in Java?
java nan
I have a program that tries to shrink a double
down to a desired number. The output I get is NaN
.
What does NaN
mean in Java?
java nan
java nan
edited Oct 28 '15 at 5:55


TryinHard
2,88122144
2,88122144
asked Apr 11 '10 at 17:57
DavidDavid
5,906286391
5,906286391
There is a good description of NaN and of the common pitfalls when using NaN in Java: ppkwok.blogspot.co.uk/2012/11/…
– Phil
Nov 25 '12 at 1:56
If you are asking "what good is NaN?" in Java (or any other language), I can give you a use case where it is very handy: when I have a 2-D array of floats, but my calculation has no meaningful value for some portion of that 2-D array, I'll fill that value with "NaN". This can be used to signal downstream users of my calculation (such as when it is turned into a raster image) "don't pay attention to the value at this point". Very useful!
– Dan H
Jun 6 '18 at 13:36
BTW, what -- exactly -- does it mean to "shrink" a double? Curious...
– Dan H
Jun 6 '18 at 13:38
add a comment |
There is a good description of NaN and of the common pitfalls when using NaN in Java: ppkwok.blogspot.co.uk/2012/11/…
– Phil
Nov 25 '12 at 1:56
If you are asking "what good is NaN?" in Java (or any other language), I can give you a use case where it is very handy: when I have a 2-D array of floats, but my calculation has no meaningful value for some portion of that 2-D array, I'll fill that value with "NaN". This can be used to signal downstream users of my calculation (such as when it is turned into a raster image) "don't pay attention to the value at this point". Very useful!
– Dan H
Jun 6 '18 at 13:36
BTW, what -- exactly -- does it mean to "shrink" a double? Curious...
– Dan H
Jun 6 '18 at 13:38
There is a good description of NaN and of the common pitfalls when using NaN in Java: ppkwok.blogspot.co.uk/2012/11/…
– Phil
Nov 25 '12 at 1:56
There is a good description of NaN and of the common pitfalls when using NaN in Java: ppkwok.blogspot.co.uk/2012/11/…
– Phil
Nov 25 '12 at 1:56
If you are asking "what good is NaN?" in Java (or any other language), I can give you a use case where it is very handy: when I have a 2-D array of floats, but my calculation has no meaningful value for some portion of that 2-D array, I'll fill that value with "NaN". This can be used to signal downstream users of my calculation (such as when it is turned into a raster image) "don't pay attention to the value at this point". Very useful!
– Dan H
Jun 6 '18 at 13:36
If you are asking "what good is NaN?" in Java (or any other language), I can give you a use case where it is very handy: when I have a 2-D array of floats, but my calculation has no meaningful value for some portion of that 2-D array, I'll fill that value with "NaN". This can be used to signal downstream users of my calculation (such as when it is turned into a raster image) "don't pay attention to the value at this point". Very useful!
– Dan H
Jun 6 '18 at 13:36
BTW, what -- exactly -- does it mean to "shrink" a double? Curious...
– Dan H
Jun 6 '18 at 13:38
BTW, what -- exactly -- does it mean to "shrink" a double? Curious...
– Dan H
Jun 6 '18 at 13:38
add a comment |
10 Answers
10
active
oldest
votes
Taken from this page:
"NaN" stands for "not a number". "Nan"
is produced if a floating point
operation has some input parameters
that cause the operation to produce
some undefined result. For example,
0.0 divided by 0.0 is arithmetically undefined. Taking the square root of a
negative number is also undefined.
16
Additionally, NaN is defined by The IEEE Standard for Floating-Point Arithmetic (IEEE 754) quite explicitly which Java follows blindly. Reading the standard opens your eyes to a lot of things, the multiple values of zero being one of the things.
– Esko
Apr 11 '10 at 18:57
35
Also,NaN
has the interesting property of being the only "number" which is not the same as itself when compared. Therefore a common (and in many languages the only) test if a numberx
isNaN
is the following:boolean isNaN(x){return x != x;}
– quazgar
Mar 18 '13 at 18:19
3
Link in answer is dead?
– Pang
Jul 1 '13 at 4:26
2
..."Taking square root of negative number is undefined (in arithmetics)"... Its not! its actuallyi
and some languages like python deal very well with it... It may be not the case injava
thou
– Rafael T
Feb 10 '14 at 18:40
4
@RafaelT I'd say it is undefined in non-complex arithmetic. There is no way to assign a complex number to a float or double in Java. Python is dynamically typed, therefore it may be possibly to just return a complex number in this case.
– sstn
Mar 27 '14 at 13:11
|
show 2 more comments
NaN
means “Not a Number” and is basically a representation of a special floating point value in the IEE 754 floating point standard. NaN generally means that the value is something that cannot be expressed with a valid floating point number.
A conversion will result in this value, when the value being converted is something else, for example when converting a string that does not represent a number.
add a comment |
NaN
means "Not a Number" and is the result of undefined operations on floating point numbers like for example dividing zero by zero. (Note that while dividing a non-zero number by zero is also usually undefined in mathematics, it does not result in NaN but in positive or negative infinity).
add a comment |
NaN
means "Not a number." It's a special floating point value that means that the result of an operation was not defined or not representable as a real number.
See here for more explanation of this value.
add a comment |
NaN stands for Not a Number. It is used to signify any value that is mathematically undefined. Like dividing 0.0 by 0.0.
You can look here for more information: https://web.archive.org/web/20120819091816/http://www.concentric.net/~ttwang/tech/javafloat.htm
Post your program here if you need more help.
add a comment |
NaN = Not a Number.
add a comment |
Means Not a Number.
It is a common representation for an impossible numeric value in many programming languages.
add a comment |
Not a Java guy, but in JS and other languages I use it's "Not a Number", meaning some operation caused it to become not a valid number.
add a comment |
It literally means "Not a Number." I suspect something is wrong with your conversion process.
Check out the Not A Number section at this reference
add a comment |
Not a valid floating-point value (e.g. the result of division by zero)
http://en.wikipedia.org/wiki/NaN
I quibble with this answer. First: "NaN" IS a valid value for an IEEE float! (After all, it is defined in the spec... so its "valid", right?). Second: "division by zero" can be represented by IEEE "Positive Infinity" or "Negative Infinity"; a better example of "NaN" is "zero divided by zero", as some other answers have correctly pointed out.
– Dan H
Jun 6 '18 at 13:33
"Valid value" and "defined in spec" is not the same thing. Agreed to 0/0.
– Vladimir Dyuzhev
Jun 7 '18 at 12:51
add a comment |
protected by Patrick Hofman Dec 27 '16 at 9:06
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
10 Answers
10
active
oldest
votes
10 Answers
10
active
oldest
votes
active
oldest
votes
active
oldest
votes
Taken from this page:
"NaN" stands for "not a number". "Nan"
is produced if a floating point
operation has some input parameters
that cause the operation to produce
some undefined result. For example,
0.0 divided by 0.0 is arithmetically undefined. Taking the square root of a
negative number is also undefined.
16
Additionally, NaN is defined by The IEEE Standard for Floating-Point Arithmetic (IEEE 754) quite explicitly which Java follows blindly. Reading the standard opens your eyes to a lot of things, the multiple values of zero being one of the things.
– Esko
Apr 11 '10 at 18:57
35
Also,NaN
has the interesting property of being the only "number" which is not the same as itself when compared. Therefore a common (and in many languages the only) test if a numberx
isNaN
is the following:boolean isNaN(x){return x != x;}
– quazgar
Mar 18 '13 at 18:19
3
Link in answer is dead?
– Pang
Jul 1 '13 at 4:26
2
..."Taking square root of negative number is undefined (in arithmetics)"... Its not! its actuallyi
and some languages like python deal very well with it... It may be not the case injava
thou
– Rafael T
Feb 10 '14 at 18:40
4
@RafaelT I'd say it is undefined in non-complex arithmetic. There is no way to assign a complex number to a float or double in Java. Python is dynamically typed, therefore it may be possibly to just return a complex number in this case.
– sstn
Mar 27 '14 at 13:11
|
show 2 more comments
Taken from this page:
"NaN" stands for "not a number". "Nan"
is produced if a floating point
operation has some input parameters
that cause the operation to produce
some undefined result. For example,
0.0 divided by 0.0 is arithmetically undefined. Taking the square root of a
negative number is also undefined.
16
Additionally, NaN is defined by The IEEE Standard for Floating-Point Arithmetic (IEEE 754) quite explicitly which Java follows blindly. Reading the standard opens your eyes to a lot of things, the multiple values of zero being one of the things.
– Esko
Apr 11 '10 at 18:57
35
Also,NaN
has the interesting property of being the only "number" which is not the same as itself when compared. Therefore a common (and in many languages the only) test if a numberx
isNaN
is the following:boolean isNaN(x){return x != x;}
– quazgar
Mar 18 '13 at 18:19
3
Link in answer is dead?
– Pang
Jul 1 '13 at 4:26
2
..."Taking square root of negative number is undefined (in arithmetics)"... Its not! its actuallyi
and some languages like python deal very well with it... It may be not the case injava
thou
– Rafael T
Feb 10 '14 at 18:40
4
@RafaelT I'd say it is undefined in non-complex arithmetic. There is no way to assign a complex number to a float or double in Java. Python is dynamically typed, therefore it may be possibly to just return a complex number in this case.
– sstn
Mar 27 '14 at 13:11
|
show 2 more comments
Taken from this page:
"NaN" stands for "not a number". "Nan"
is produced if a floating point
operation has some input parameters
that cause the operation to produce
some undefined result. For example,
0.0 divided by 0.0 is arithmetically undefined. Taking the square root of a
negative number is also undefined.
Taken from this page:
"NaN" stands for "not a number". "Nan"
is produced if a floating point
operation has some input parameters
that cause the operation to produce
some undefined result. For example,
0.0 divided by 0.0 is arithmetically undefined. Taking the square root of a
negative number is also undefined.
edited Dec 1 '15 at 16:53


RAnders00
3,06942551
3,06942551
answered Apr 11 '10 at 18:00
KennyDeriemaekerKennyDeriemaeker
1,72111315
1,72111315
16
Additionally, NaN is defined by The IEEE Standard for Floating-Point Arithmetic (IEEE 754) quite explicitly which Java follows blindly. Reading the standard opens your eyes to a lot of things, the multiple values of zero being one of the things.
– Esko
Apr 11 '10 at 18:57
35
Also,NaN
has the interesting property of being the only "number" which is not the same as itself when compared. Therefore a common (and in many languages the only) test if a numberx
isNaN
is the following:boolean isNaN(x){return x != x;}
– quazgar
Mar 18 '13 at 18:19
3
Link in answer is dead?
– Pang
Jul 1 '13 at 4:26
2
..."Taking square root of negative number is undefined (in arithmetics)"... Its not! its actuallyi
and some languages like python deal very well with it... It may be not the case injava
thou
– Rafael T
Feb 10 '14 at 18:40
4
@RafaelT I'd say it is undefined in non-complex arithmetic. There is no way to assign a complex number to a float or double in Java. Python is dynamically typed, therefore it may be possibly to just return a complex number in this case.
– sstn
Mar 27 '14 at 13:11
|
show 2 more comments
16
Additionally, NaN is defined by The IEEE Standard for Floating-Point Arithmetic (IEEE 754) quite explicitly which Java follows blindly. Reading the standard opens your eyes to a lot of things, the multiple values of zero being one of the things.
– Esko
Apr 11 '10 at 18:57
35
Also,NaN
has the interesting property of being the only "number" which is not the same as itself when compared. Therefore a common (and in many languages the only) test if a numberx
isNaN
is the following:boolean isNaN(x){return x != x;}
– quazgar
Mar 18 '13 at 18:19
3
Link in answer is dead?
– Pang
Jul 1 '13 at 4:26
2
..."Taking square root of negative number is undefined (in arithmetics)"... Its not! its actuallyi
and some languages like python deal very well with it... It may be not the case injava
thou
– Rafael T
Feb 10 '14 at 18:40
4
@RafaelT I'd say it is undefined in non-complex arithmetic. There is no way to assign a complex number to a float or double in Java. Python is dynamically typed, therefore it may be possibly to just return a complex number in this case.
– sstn
Mar 27 '14 at 13:11
16
16
Additionally, NaN is defined by The IEEE Standard for Floating-Point Arithmetic (IEEE 754) quite explicitly which Java follows blindly. Reading the standard opens your eyes to a lot of things, the multiple values of zero being one of the things.
– Esko
Apr 11 '10 at 18:57
Additionally, NaN is defined by The IEEE Standard for Floating-Point Arithmetic (IEEE 754) quite explicitly which Java follows blindly. Reading the standard opens your eyes to a lot of things, the multiple values of zero being one of the things.
– Esko
Apr 11 '10 at 18:57
35
35
Also,
NaN
has the interesting property of being the only "number" which is not the same as itself when compared. Therefore a common (and in many languages the only) test if a number x
is NaN
is the following: boolean isNaN(x){return x != x;}
– quazgar
Mar 18 '13 at 18:19
Also,
NaN
has the interesting property of being the only "number" which is not the same as itself when compared. Therefore a common (and in many languages the only) test if a number x
is NaN
is the following: boolean isNaN(x){return x != x;}
– quazgar
Mar 18 '13 at 18:19
3
3
Link in answer is dead?
– Pang
Jul 1 '13 at 4:26
Link in answer is dead?
– Pang
Jul 1 '13 at 4:26
2
2
..."Taking square root of negative number is undefined (in arithmetics)"... Its not! its actually
i
and some languages like python deal very well with it... It may be not the case in java
thou– Rafael T
Feb 10 '14 at 18:40
..."Taking square root of negative number is undefined (in arithmetics)"... Its not! its actually
i
and some languages like python deal very well with it... It may be not the case in java
thou– Rafael T
Feb 10 '14 at 18:40
4
4
@RafaelT I'd say it is undefined in non-complex arithmetic. There is no way to assign a complex number to a float or double in Java. Python is dynamically typed, therefore it may be possibly to just return a complex number in this case.
– sstn
Mar 27 '14 at 13:11
@RafaelT I'd say it is undefined in non-complex arithmetic. There is no way to assign a complex number to a float or double in Java. Python is dynamically typed, therefore it may be possibly to just return a complex number in this case.
– sstn
Mar 27 '14 at 13:11
|
show 2 more comments
NaN
means “Not a Number” and is basically a representation of a special floating point value in the IEE 754 floating point standard. NaN generally means that the value is something that cannot be expressed with a valid floating point number.
A conversion will result in this value, when the value being converted is something else, for example when converting a string that does not represent a number.
add a comment |
NaN
means “Not a Number” and is basically a representation of a special floating point value in the IEE 754 floating point standard. NaN generally means that the value is something that cannot be expressed with a valid floating point number.
A conversion will result in this value, when the value being converted is something else, for example when converting a string that does not represent a number.
add a comment |
NaN
means “Not a Number” and is basically a representation of a special floating point value in the IEE 754 floating point standard. NaN generally means that the value is something that cannot be expressed with a valid floating point number.
A conversion will result in this value, when the value being converted is something else, for example when converting a string that does not represent a number.
NaN
means “Not a Number” and is basically a representation of a special floating point value in the IEE 754 floating point standard. NaN generally means that the value is something that cannot be expressed with a valid floating point number.
A conversion will result in this value, when the value being converted is something else, for example when converting a string that does not represent a number.
edited Dec 27 '16 at 10:22
answered Apr 11 '10 at 18:01
pokepoke
217k46337400
217k46337400
add a comment |
add a comment |
NaN
means "Not a Number" and is the result of undefined operations on floating point numbers like for example dividing zero by zero. (Note that while dividing a non-zero number by zero is also usually undefined in mathematics, it does not result in NaN but in positive or negative infinity).
add a comment |
NaN
means "Not a Number" and is the result of undefined operations on floating point numbers like for example dividing zero by zero. (Note that while dividing a non-zero number by zero is also usually undefined in mathematics, it does not result in NaN but in positive or negative infinity).
add a comment |
NaN
means "Not a Number" and is the result of undefined operations on floating point numbers like for example dividing zero by zero. (Note that while dividing a non-zero number by zero is also usually undefined in mathematics, it does not result in NaN but in positive or negative infinity).
NaN
means "Not a Number" and is the result of undefined operations on floating point numbers like for example dividing zero by zero. (Note that while dividing a non-zero number by zero is also usually undefined in mathematics, it does not result in NaN but in positive or negative infinity).
answered Apr 11 '10 at 17:59
sepp2ksepp2k
299k39601617
299k39601617
add a comment |
add a comment |
NaN
means "Not a number." It's a special floating point value that means that the result of an operation was not defined or not representable as a real number.
See here for more explanation of this value.
add a comment |
NaN
means "Not a number." It's a special floating point value that means that the result of an operation was not defined or not representable as a real number.
See here for more explanation of this value.
add a comment |
NaN
means "Not a number." It's a special floating point value that means that the result of an operation was not defined or not representable as a real number.
See here for more explanation of this value.
NaN
means "Not a number." It's a special floating point value that means that the result of an operation was not defined or not representable as a real number.
See here for more explanation of this value.
answered Apr 11 '10 at 17:59
Mike DanielsMike Daniels
7,86912444
7,86912444
add a comment |
add a comment |
NaN stands for Not a Number. It is used to signify any value that is mathematically undefined. Like dividing 0.0 by 0.0.
You can look here for more information: https://web.archive.org/web/20120819091816/http://www.concentric.net/~ttwang/tech/javafloat.htm
Post your program here if you need more help.
add a comment |
NaN stands for Not a Number. It is used to signify any value that is mathematically undefined. Like dividing 0.0 by 0.0.
You can look here for more information: https://web.archive.org/web/20120819091816/http://www.concentric.net/~ttwang/tech/javafloat.htm
Post your program here if you need more help.
add a comment |
NaN stands for Not a Number. It is used to signify any value that is mathematically undefined. Like dividing 0.0 by 0.0.
You can look here for more information: https://web.archive.org/web/20120819091816/http://www.concentric.net/~ttwang/tech/javafloat.htm
Post your program here if you need more help.
NaN stands for Not a Number. It is used to signify any value that is mathematically undefined. Like dividing 0.0 by 0.0.
You can look here for more information: https://web.archive.org/web/20120819091816/http://www.concentric.net/~ttwang/tech/javafloat.htm
Post your program here if you need more help.
edited Oct 15 '15 at 20:25
BennyMcBenBen
86221637
86221637
answered Apr 11 '10 at 18:01
PrachiPrachi
18817
18817
add a comment |
add a comment |
NaN = Not a Number.
add a comment |
NaN = Not a Number.
add a comment |
NaN = Not a Number.
NaN = Not a Number.
answered Apr 11 '10 at 17:59


Fitzchak YitzchakiFitzchak Yitzchaki
6,76374589
6,76374589
add a comment |
add a comment |
Means Not a Number.
It is a common representation for an impossible numeric value in many programming languages.
add a comment |
Means Not a Number.
It is a common representation for an impossible numeric value in many programming languages.
add a comment |
Means Not a Number.
It is a common representation for an impossible numeric value in many programming languages.
Means Not a Number.
It is a common representation for an impossible numeric value in many programming languages.
answered Apr 11 '10 at 18:04
lbedognilbedogni
5,88172246
5,88172246
add a comment |
add a comment |
Not a Java guy, but in JS and other languages I use it's "Not a Number", meaning some operation caused it to become not a valid number.
add a comment |
Not a Java guy, but in JS and other languages I use it's "Not a Number", meaning some operation caused it to become not a valid number.
add a comment |
Not a Java guy, but in JS and other languages I use it's "Not a Number", meaning some operation caused it to become not a valid number.
Not a Java guy, but in JS and other languages I use it's "Not a Number", meaning some operation caused it to become not a valid number.
answered Apr 11 '10 at 17:59
Brian MainsBrian Mains
44.1k32128233
44.1k32128233
add a comment |
add a comment |
It literally means "Not a Number." I suspect something is wrong with your conversion process.
Check out the Not A Number section at this reference
add a comment |
It literally means "Not a Number." I suspect something is wrong with your conversion process.
Check out the Not A Number section at this reference
add a comment |
It literally means "Not a Number." I suspect something is wrong with your conversion process.
Check out the Not A Number section at this reference
It literally means "Not a Number." I suspect something is wrong with your conversion process.
Check out the Not A Number section at this reference
answered Apr 11 '10 at 17:59
Chris ThompsonChris Thompson
29.2k96999
29.2k96999
add a comment |
add a comment |
Not a valid floating-point value (e.g. the result of division by zero)
http://en.wikipedia.org/wiki/NaN
I quibble with this answer. First: "NaN" IS a valid value for an IEEE float! (After all, it is defined in the spec... so its "valid", right?). Second: "division by zero" can be represented by IEEE "Positive Infinity" or "Negative Infinity"; a better example of "NaN" is "zero divided by zero", as some other answers have correctly pointed out.
– Dan H
Jun 6 '18 at 13:33
"Valid value" and "defined in spec" is not the same thing. Agreed to 0/0.
– Vladimir Dyuzhev
Jun 7 '18 at 12:51
add a comment |
Not a valid floating-point value (e.g. the result of division by zero)
http://en.wikipedia.org/wiki/NaN
I quibble with this answer. First: "NaN" IS a valid value for an IEEE float! (After all, it is defined in the spec... so its "valid", right?). Second: "division by zero" can be represented by IEEE "Positive Infinity" or "Negative Infinity"; a better example of "NaN" is "zero divided by zero", as some other answers have correctly pointed out.
– Dan H
Jun 6 '18 at 13:33
"Valid value" and "defined in spec" is not the same thing. Agreed to 0/0.
– Vladimir Dyuzhev
Jun 7 '18 at 12:51
add a comment |
Not a valid floating-point value (e.g. the result of division by zero)
http://en.wikipedia.org/wiki/NaN
Not a valid floating-point value (e.g. the result of division by zero)
http://en.wikipedia.org/wiki/NaN
answered Apr 11 '10 at 17:59


Vladimir DyuzhevVladimir Dyuzhev
15.9k94357
15.9k94357
I quibble with this answer. First: "NaN" IS a valid value for an IEEE float! (After all, it is defined in the spec... so its "valid", right?). Second: "division by zero" can be represented by IEEE "Positive Infinity" or "Negative Infinity"; a better example of "NaN" is "zero divided by zero", as some other answers have correctly pointed out.
– Dan H
Jun 6 '18 at 13:33
"Valid value" and "defined in spec" is not the same thing. Agreed to 0/0.
– Vladimir Dyuzhev
Jun 7 '18 at 12:51
add a comment |
I quibble with this answer. First: "NaN" IS a valid value for an IEEE float! (After all, it is defined in the spec... so its "valid", right?). Second: "division by zero" can be represented by IEEE "Positive Infinity" or "Negative Infinity"; a better example of "NaN" is "zero divided by zero", as some other answers have correctly pointed out.
– Dan H
Jun 6 '18 at 13:33
"Valid value" and "defined in spec" is not the same thing. Agreed to 0/0.
– Vladimir Dyuzhev
Jun 7 '18 at 12:51
I quibble with this answer. First: "NaN" IS a valid value for an IEEE float! (After all, it is defined in the spec... so its "valid", right?). Second: "division by zero" can be represented by IEEE "Positive Infinity" or "Negative Infinity"; a better example of "NaN" is "zero divided by zero", as some other answers have correctly pointed out.
– Dan H
Jun 6 '18 at 13:33
I quibble with this answer. First: "NaN" IS a valid value for an IEEE float! (After all, it is defined in the spec... so its "valid", right?). Second: "division by zero" can be represented by IEEE "Positive Infinity" or "Negative Infinity"; a better example of "NaN" is "zero divided by zero", as some other answers have correctly pointed out.
– Dan H
Jun 6 '18 at 13:33
"Valid value" and "defined in spec" is not the same thing. Agreed to 0/0.
– Vladimir Dyuzhev
Jun 7 '18 at 12:51
"Valid value" and "defined in spec" is not the same thing. Agreed to 0/0.
– Vladimir Dyuzhev
Jun 7 '18 at 12:51
add a comment |
protected by Patrick Hofman Dec 27 '16 at 9:06
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
There is a good description of NaN and of the common pitfalls when using NaN in Java: ppkwok.blogspot.co.uk/2012/11/…
– Phil
Nov 25 '12 at 1:56
If you are asking "what good is NaN?" in Java (or any other language), I can give you a use case where it is very handy: when I have a 2-D array of floats, but my calculation has no meaningful value for some portion of that 2-D array, I'll fill that value with "NaN". This can be used to signal downstream users of my calculation (such as when it is turned into a raster image) "don't pay attention to the value at this point". Very useful!
– Dan H
Jun 6 '18 at 13:36
BTW, what -- exactly -- does it mean to "shrink" a double? Curious...
– Dan H
Jun 6 '18 at 13:38