Re: unsigning NSNumber

2008-07-26 Thread Graham Cox
On 27 Jul 2008, at 2:48 am, Justin Giboney wrote: Multiply by -1 No, that's not the same as fabs(x). If the number is already +ve, *-1 it will make it -ve. fabs(x) makes -ve numbers +ve, but not vice versa. In any case you can't multiply NSNumber by anything - it's immutable. Graham __

Re: unsigning NSNumber

2008-07-26 Thread Steven Hamilton
Thanks all, fabs() is just what I need. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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

Re: unsigning NSNumber

2008-07-26 Thread Justin Giboney
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

Re: unsigning NSNumber

2008-07-26 Thread Graham Cox
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 200

unsigning NSNumber

2008-07-26 Thread Steven Hamilton
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 (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to

Re: unsigning NSNumber

2008-07-26 Thread Phil
On Wed, Jul 23, 2008 at 12:20 AM, Steven Hamilton <[EMAIL PROTECTED]> wrote: > Can anyone tell me the most efficient way to unsign a floatvalue in an > NSNumber? > > Like change a -1.47 to 1.47 ? > fabsf(3) Phil

Re: unsigning NSNumber

2008-07-26 Thread Ron Fleckner
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;

unsigning NSNumber

2008-07-26 Thread Steven Hamilton
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 (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the l