• 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: flummoxed by math failure
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: flummoxed by math failure


  • Subject: Re: flummoxed by math failure
  • From: "Dean G. Tresner" <email@hidden>
  • Date: Wed, 23 Jul 2003 00:04:48 -0600

I had several responses like Angela's and I'm sorry, I was a bit tired. These were just trivial accessor methods of the object being implemented here so I wasn't bothering to be consistent. Just to make sure, I edited the code snippet to use the two (NSDecimalNumber *) members directly:

NSDecimalNumber *t;
t = [hours decimalNumberByMultiplyingBy:rate]; // withBehavior:numBehavior];
NSLog(@"%@ X %@ = %@", hours, rate , t);

Which gave the same results.

As to whether this is an autorelease issue, I don't see how--hours and rate are continuing to report their correct values, and I commented out the withBehavior: argument specifically to rule out an autorelease issue there.

Dean

On Tuesday, Jul 22, 2003, at 17:47 America/Denver, Angela Brett wrote:



NSDecimalNumber *t;
t = [[self hours] decimalNumberByMultiplyingBy:[self rate]]; //
withBehavior:numBehavior];
NSLog([NSString stringWithFormat:@"%@ X %@ = %@", [hours description],
[rate description], [t description]]);

Run through twice produces:

2003-07-22 16:43:50.888 Work Timer[8128] 1 X 100 = 0
2003-07-22 16:43:50.888 Work Timer[8128] 2 X 100 = 0

I realise this is just a cut-down version of the problem so it's probably
not the exact code, but is it possible that rate and hours differ from
[self rate] and [self hours] used in the calculation?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: flummoxed by math failure
      • From: Karl Kraft <email@hidden>
    • Re: flummoxed by math failure
      • From: Nat! <email@hidden>
  • Prev by Date: Re: Bug reports and documentation updates (was Re: Subclassing NSPort (or NSSocketPort))
  • Next by Date: Re: Odd NSDictionary Problem
  • Previous by thread: Re: flummoxed by math failure
  • Next by thread: Re: flummoxed by math failure
  • Index(es):
    • Date
    • Thread