• 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: floatValue of nil NSNumber unreliable (was Re: Bug or feature?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: floatValue of nil NSNumber unreliable (was Re: Bug or feature?)


  • Subject: Re: floatValue of nil NSNumber unreliable (was Re: Bug or feature?)
  • From: Andy Armstrong <email@hidden>
  • Date: Tue, 14 Feb 2006 19:07:26 +0000

On 14 Feb 2006, at 18:21, Daniel Jalkut wrote:
Interesting. I just took your snippet and also reproduced funny behavior (identical config to yours, incidentally).

What's interesting is the "random number" seems to correspond to the last "real float NSNumber" used.

For instance:

  float fval=0.0;
   NSNumber *aNumber=nil;
   NSNumber *secondNumber = [NSNumber numberWithFloat:0.5];
   fval=[aNumber floatValue];
   NSLog(@"fval is %f",fval);

fval is always 0.5.

It sounds like a bug to me. Maybe somebody from Apple will have an opinion about this.

I presume - without having looked at generated code - that the floating point register that would be used to return a result is not being initialised in the case where the pointer is nil - so you're seeing whatever value was previously in that register.


--
Andy Armstrong, hexten.net

_______________________________________________
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: 
 >Re: Bug or feature? (From: "M. Carlson" <email@hidden>)
 >floatValue of nil NSNumber unreliable (was Re: Bug or feature?) (From: Daniel Jalkut <email@hidden>)

  • Prev by Date: Re: floatValue of nil NSNumber unreliable (was Re: Bug or feature?)
  • Next by Date: Re: MDItemCreate very, very, very, slow -- and fails
  • Previous by thread: Re: floatValue of nil NSNumber unreliable (was Re: Bug or feature?)
  • Next by thread: Re: Bug or feature?
  • Index(es):
    • Date
    • Thread