• 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: "Justin Giboney" <email@hidden>
  • Date: Sat, 26 Jul 2008 09:48:05 -0700 (PDT)
  • Importance: Normal

Multiply by -1

> float val = [mySignedNumber floatValue];
>
> NSNumber* myAbsoluteNumber = [NSNumber numberWithFloat:fabsf( val )];
>
> (note NSNumber is immutable so you can't change what it contains to
> remove the sign. You can create a new NSNumber with the absolute value
> however).
>
>
> hth,
>
> Graham
>
>
>
> On 23 Jul 2008, at 6:41 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
>
> _______________________________________________
>
> 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
>
>


_______________________________________________

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

  • Follow-Ups:
    • Re: unsigning NSNumber
      • From: Graham Cox <email@hidden>
References: 
 >unsigning NSNumber (From: Steven Hamilton <email@hidden>)
 >unsigning NSNumber (From: Steven Hamilton <email@hidden>)
 >Re: unsigning NSNumber (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: NSNumber Formatter with percent?
  • Next by Date: CFSTR and double-double quotes
  • Previous by thread: Re: unsigning NSNumber
  • Next by thread: Re: unsigning NSNumber
  • Index(es):
    • Date
    • Thread