Re: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Darren Minifie
"After linking them my warning count went way down" Chris this is a GREAT line haha. Seriously though, treat all warnings as errors. Fix em' up, as they are usually the cause of strange behavior. On Wed, Sep 8, 2010 at 2:28 PM, Chris Tracewell wrote: > After linking them my warning count went

Re: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Chris Tracewell
On Sep 8, 2010, at 1:29 PM, Greg Parker wrote: > On Sep 8, 2010, at 12:40 PM, Chris Tracewell wrote: >> On Sep 8, 2010, at 12:02 PM, cocoa-dev-requ...@lists.apple.com wrote: >>> It's not YES that's being "returned as" -256, but NO. (The answer is NO in >>> all 3 cases.) -256 is 0xFF00, so yo

Re: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Greg Parker
On Sep 8, 2010, at 12:40 PM, Chris Tracewell wrote: > On Sep 8, 2010, at 12:02 PM, cocoa-dev-requ...@lists.apple.com wrote: >> It's not YES that's being "returned as" -256, but NO. (The answer is NO in >> all 3 cases.) -256 is 0xFF00, so you can see that NO (i.e. (signed char) >> 0) is being

Re: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Quincey Morris
On Sep 8, 2010, at 12:40, Chris Tracewell wrote: > I must admit that I do not understand why this is so. I can for example use > if ([someButton isEnabled]) and it returns a BOOL and the if statement works > fine. If you have any pointers or docs that explains this further I would > really app

Re: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Chris Tracewell
On Sep 8, 2010, at 12:02 PM, cocoa-dev-requ...@lists.apple.com wrote: > It's not YES that's being "returned as" -256, but NO. (The answer is NO in > all 3 cases.) -256 is 0xFF00, so you can see that NO (i.e. (signed char) > 0) is being correctly returned in the low order byte, with trash in

Re: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Kyle Sluder
On Tue, Sep 7, 2010 at 5:58 PM, Chris Tracewell wrote: > I have a category on NSDecimalNumber that seems very straight forward - yet > is producing odd results. The code below shows my logging and everything > outputs as expected - but the final evaluation does not work. Am I > misunderstanding

Re: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Chris Tracewell
On Sep 8, 2010, at 10:21 AM, cocoa-dev-requ...@lists.apple.com wrote: > The message in the 'if' ([theNumOne compare:theNumTwo]) is an invocation of > [NSNumber compare:], not [NSDecimalNumber compare:]. It's not absolutely > clear what is supposed to happen when the compare parameter is an inst

Re: NSNumber compare: Giving Unexpected Results

2010-09-07 Thread Quincey Morris
On Sep 7, 2010, at 17:58, Chris Tracewell wrote: > -(BOOL)isLessThanZero > { > NSNumber *theNumOne = [NSNumber numberWithInteger:0]; > NSNumber *theNumTwo = self; > > NSLog(@"theNumOne = %@",theNumOne); > NSLog(@"theNumTwo = %@",theNumTwo); > NSLog(@"NSOr

NSNumber compare: Giving Unexpected Results

2010-09-07 Thread Chris Tracewell
I have a category on NSDecimalNumber that seems very straight forward - yet is producing odd results. The code below shows my logging and everything outputs as expected - but the final evaluation does not work. Am I misunderstanding something? -(BOOL)isLessThanZero { NSNumber *t