Forums
How to tell if a variable is Infinity or NaN (not a number)?
5 posts
• Page 1 of 1
How to tell if a variable is Infinity or NaN (not a number)?
I'm playing with the BlindWatchMaker1.cobra program that came with the installation and making some changes to the code. I need to add an if statement which checks whether a variable is either NaN or Infinity, how would I do that?
- JohnSchock
- Posts: 2
Re: How to tell if a variable is Infinity or NaN (not a numb
x.isNaN and x.isInfinity
In other words, these are properties on "float" typed values. You can see all the properties and methods on primitive types at the PrimitiveTypeMembers wiki page.
In other words, these are properties on "float" typed values. You can see all the properties and methods on primitive types at the PrimitiveTypeMembers wiki page.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: How to tell if a variable is Infinity or NaN (not a numb
more directly:
if x.isNaN or x.isInfinity, trace x
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: How to tell if a variable is Infinity or NaN (not a numb
One more note. You're always free to post questions here, but I just wanted to point out that if you use the wiki search for things like "infinity" you will get your answers even faster. And then, of course, it becomes interesting to find out what answers you did not get from the wiki so we (and possibly you) can expand it.
Our forums have a search as well. Unfortunately, these are two separate software packages and although we managed to integrate their user accounts, the searches are separate for now.
Our forums have a search as well. Unfortunately, these are two separate software packages and although we managed to integrate their user accounts, the searches are separate for now.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: How to tell if a variable is Infinity or NaN (not a numb
Chuck wrote:One more note. You're always free to post questions here, but I just wanted to point out that if you use the wiki search for things like "infinity" you will get your answers even faster.
Yea, I actually found the answer almost immediately after I posted
- JohnSchock
- Posts: 2
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 58 guests