Re: NaN (Not a Number) Error using Bindings
Re: NaN (Not a Number) Error using Bindings
- Subject: Re: NaN (Not a Number) Error using Bindings
- From: "John C. Randolph" <email@hidden>
- Date: Tue, 4 Jan 2005 10:50:31 -0800
On Jan 4, 2005, at 10:27 AM, J. Scott Anderson wrote:
- (double)quoteProfitMargin //
TODO: Fix this. I get an "NaN" (Not a Number) result in compiled
application.
{
return (double)(quoteExtendedCost / quoteExtendedPrice);
}
When you first launch the app, it's quite likely that your bindings are
trying to get a value for quoteProfitMargin before any values are set
in your model.
I'd try:
- (double) quoteProfitMargin
{ return quoteExtendedPrice == 0.0 ? 0.0 : (quoteExtendedCost /
quoteExtendedPrice); }
-jcr
John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden