Results 1 to 8 of 8
Thread: Is it possible to test for NaN?
- 05-06-2010, 08:34 PM #1
Member
- Join Date
- Apr 2010
- Posts
- 59
- Rep Power
- 0
- 05-06-2010, 08:46 PM #2
Member
- Join Date
- Apr 2010
- Posts
- 59
- Rep Power
- 0
I have researched this further and recognise that there is a command:
isNan from
Double (Java 2 Platform SE 5.0))
The problem is I do not know how work it with my program. I have a variable called statistics[1] and I want to test to see if it is NaN
I am very thankful for any help.
- 05-06-2010, 08:57 PM #3
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
returns true when it is an NaN. OrJava Code:Double.isNaN(doubleVar)
also returns true for an NaN. This, in fact, is the IEEE defined test for NaN and is exactly what isNaN does.Java Code:doubleVar != doubleVar
- 05-06-2010, 09:18 PM #4
Member
- Join Date
- Apr 2010
- Posts
- 59
- Rep Power
- 0
I note the program says Double.isNaN(doubleVar)
Does this mean the variable tested has to be a double?
I have an integer called stats2[0]. I want to test it for errors (i.e. isNAN). I have tried using
boolean error=Double.isNaN(stats2[1]);
However, the variable always returns as false (when it is a proper value).
Please help!
- 05-06-2010, 09:47 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
- 05-06-2010, 09:53 PM #6
Member
- Join Date
- Apr 2010
- Posts
- 59
- Rep Power
- 0
JosAH
but somehow mine are!
I worked out what I was doing wrong and have now got the test working successfully.
Thank you.
- 05-06-2010, 11:35 PM #7
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
- 05-07-2010, 02:22 AM #8
Senior Member
- Join Date
- Oct 2009
- Location
- California,US
- Posts
- 201
- Rep Power
- 4
Similar Threads
-
how did everyone do on the ap test last tuesday?
By blueduiker in forum New To JavaReplies: 8Last Post: 05-07-2010, 01:56 AM -
A test-question on XSL-FO.
By an24 in forum XMLReplies: 0Last Post: 12-28-2009, 02:36 PM -
Connectivity Test
By jimhaddon in forum Java AppletsReplies: 9Last Post: 08-16-2008, 04:40 PM -
Test Advisory Panel-Telecommute- Test your Java skills + share insights on Java tests
By michelle in forum Jobs OfferedReplies: 0Last Post: 04-05-2008, 12:38 AM -
Palindrome Test
By Ada in forum New To JavaReplies: 1Last Post: 05-26-2007, 01:36 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks