Jim Fulton wrote:
Guido van Rossum wrote: >
What would be scale of the product of two fixed-decimal numbers? E.g. is 2.00L * 2.00L equal to 4.0000L, or equal to 4.00L? There are arguments for either. Same question for division (harder, I think).
I'd be inclined to start by doing some research to see if some standard (SQL?) defines this somewhere. It would be nice if someone has already done the requirements work for us. :)
Here is what the book "SQL-99 Complete, Really" says that the SQL standard says:
for addition and subtraction of two "exact" (fixed-decimal) numbers, the result has the maximum of the scales.
for multiplication of two "exact" (fixed-decimal) numbers, the result has the sum of the scales.
punts on division
for addition, subtraction, multiplication or division between "exact" (fixed point) and "approximate" (floating point) yields an approximate result. This means that fixed-decimal coerces to float.
I'm curious to see who else chips in with examples from other systems.
Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.