• 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: Compare NSNumber with an int
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compare NSNumber with an int


  • Subject: Re: Compare NSNumber with an int
  • From: Nat! <email@hidden>
  • Date: Mon, 15 Dec 2003 16:38:14 +0100

Am 15.12.2003 um 15:38 schrieb Just van Rossum:

The docs for intValue say "Returns the receiver's value as an int,
converting it as necessary.", which suggests the former should work just
as well (but with less overhead).


That depends, if you want 10.2 and 10 to be equal or not

[[NSNumber numberWithInt:10] isEqual:[NSNumber numberWithDouble:10.2]] yields NO

[[NSNumber numberWithInt:10] intValue] == [[NSNumber numberWithDouble:10.2] intValue] yields YES

Ciao
Nat!

I act professionally, when I get paid for it. - Unknown
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Compare NSNumber with an int (From: Just van Rossum <email@hidden>)

  • Prev by Date: Re: Compare NSNumber with an int
  • Next by Date: Which method to show the value of NSDateFormatter etc...
  • Previous by thread: Re: Compare NSNumber with an int
  • Next by thread: Remove excess line breaks
  • Index(es):
    • Date
    • Thread