Re: Getting a handle on inf
Re: Getting a handle on inf
- Subject: Re: Getting a handle on inf
- From: Greg Parker <email@hidden>
- Date: Mon, 26 Oct 2009 11:45:22 -0700
On Oct 26, 2009, at 11:26 AM, Ian Piper wrote:
So I am guessing that when I get a float displayed as "inf" this is
not the string it seems to be. Also, it looks like the string value
of whatever is coming back is not something that I can use. Can
anyone suggest how I might handle a test case like this?
As Kyle noted, -stringValue returns an NSString, not a char*. You'd
need to compare to @"inf" and print with %@.
A better way to check for floating-point +infinity and -infinity is to
use the isinf() macro.
if (isinf([number floatValue])) {
NSLog(@"number is +inf or -inf");
}
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden