• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NaN (Not a Number) Error using Bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >NaN (Not a Number) Error using Bindings (From: "J. Scott Anderson" <email@hidden>)

  • Prev by Date: Re: NSArrayController for unordered collection (a Set)
  • Next by Date: Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ???
  • Previous by thread: Re: NaN (Not a Number) Error using Bindings
  • Next by thread: NSTextView replaceCharactersInRange performance and thread safety
  • Index(es):
    • Date
    • Thread