Re: working with NSDecimalNumber and NSNumber
Re: working with NSDecimalNumber and NSNumber
- Subject: Re: working with NSDecimalNumber and NSNumber
- From: Uli Kusterer <email@hidden>
- Date: Mon, 3 Jul 2006 11:43:32 +0200
Am 03.07.2006 um 02:05 schrieb William Squires:
Be careful multiplying (or dividing) fractions (like when
calculating interest, APR, etc...) For example: 3 cents x 3 cents
is clearly 9 cents, but $0.03 x $0.03 = $0.0009, or 9 one-
hundredths of a penny. Whoops.
Errr... this part is nonsense. $0.03 x $0.03 would be $^2 0.0009
(yes, that's "dollar squared"). Which may be a nice number, but has
absolutely no practical value. Your result would be 0.03 x $0.03, and
thus in no way equivalent or even close to $0.03 * $0.03.
The point of this is that all expressions with units should
essentially be read as being multiplied with their unit, i.e. $3
would be 3 * $. As such, $3 * $3 would be 3 * 3 * $ * $, and that in
turn is 3 ^2 * $^2, or 9 * $^2, which doesn't make much sense.
Instead, in usual maths, you never multiply dollars by dollars, you
simply multiply the "counter" before the unit. So, you'd always do 3
* 3 * $ to triple three dollars.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden