• 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: unsigning NSNumber
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unsigning NSNumber


  • Subject: Re: unsigning NSNumber
  • From: Ron Fleckner <email@hidden>
  • Date: Sat, 26 Jul 2008 20:30:38 +1000


On 22/07/2008, at 10:20 PM, Steven Hamilton wrote:

Hi folks,
Can anyone tell me the most efficient way to unsign a floatvalue in an NSNumber?


Like change a -1.47 to 1.47 ?

Thanks


//	Below reverses the sign of, in this case, a float
	float y, x; y = x = -12.0;
	y -= x * 2; // reverses the sign of x.
	printf("y = %f\n", y); // y = 12.000000

I don't think there's a method on NSNumber which does it for you, so obviously you'd need to extract the value from your NSNumber instance and then use the new value in a new NSNumber.

HTH,

Ron
_______________________________________________

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


References: 
 >unsigning NSNumber (From: Steven Hamilton <email@hidden>)

  • Prev by Date: Re: Retrieving the current -[NSShadow set]
  • Next by Date: Re: unsigning NSNumber
  • Previous by thread: unsigning NSNumber
  • Next by thread: Re: unsigning NSNumber
  • Index(es):
    • Date
    • Thread