 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Henry Guest
|
Posted: Thu May 20, 2004 2:13 pm Post subject: NaN in the JVM |
|
|
Hi,
I want to know what is the semantic of the value NaN (when using float). Is
this a special value only for errors ? Or can there be cases where NaN is
set by the JVM in valid operations ?
My understanding of NaN is that it is used each time you divide by zero.
Thanks in advance,
Henry
|
|
| Back to top |
|
 |
Jonas Geiregat Guest
|
Posted: Tue Jun 15, 2004 1:55 pm Post subject: Re: NaN in the JVM |
|
|
Henry wrote:
| Quote: | Hi,
I want to know what is the semantic of the value NaN (when using float). Is
this a special value only for errors ? Or can there be cases where NaN is
set by the JVM in valid operations ?
My understanding of NaN is that it is used each time you divide by zero.
Thanks in advance,
Henry
|
Doesn't NaN stand for Not a Number ?
|
|
| Back to top |
|
 |
Chris Smith Guest
|
Posted: Tue Jun 15, 2004 2:07 pm Post subject: Re: NaN in the JVM |
|
|
Jonas Geiregat wrote:
| Quote: | Doesn't NaN stand for Not a Number ?
|
Yes, it does.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
|
|
| Back to top |
|
 |
Andrew Thompson Guest
|
Posted: Tue Jun 15, 2004 2:16 pm Post subject: Re: NaN in the JVM |
|
|
On Tue, 15 Jun 2004 15:55:59 +0200, Jonas Geiregat wrote:
| Quote: | Henry wrote:
...
My understanding of NaN is that it is used each time you divide by zero.
...
Doesn't NaN stand for Not a Number ?
|
It does, try this..
System.out.println( Math.sqrt( -1 ) );
Attempts to divide by zero will also
result in a mathematical entity that
is not representable in the normal
numeric range. (..err I forget the
term for such a number)
--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
|
|
| Back to top |
|
 |
Mark Bottomley Guest
|
Posted: Wed Jun 16, 2004 12:19 am Post subject: Re: NaN in the JVM |
|
|
"Andrew Thompson" <SeeMySites (AT) www (DOT) invalid> wrote
| Quote: | On Tue, 15 Jun 2004 15:55:59 +0200, Jonas Geiregat wrote:
Henry wrote:
..
My understanding of NaN is that it is used each time you divide by
zero.
..
Doesn't NaN stand for Not a Number ?
It does, try this..
System.out.println( Math.sqrt( -1 ) );
Attempts to divide by zero will also
result in a mathematical entity that
is not representable in the normal
numeric range. (..err I forget the
term for such a number)
--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
|
One of the best sites for understanding floating point numbers
is http://babbage.cs.qc.edu/courses/cs341/IEEE-754references.html
It identifies Quiet and Signalling Nan's. There are also +/- infinities,
+/- zeroes, denormalized floating point numbers and signed underflows.
The links off the page go to on-line hex/float43/float64 conversions.
You can also find many of the rules for Nan's and infinities in the JVM
spec.
Mark...
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|