Re: unsigning NSNumber
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