On 28-4-2014 16:29, Carlos H. Cantu wrote: > 8) Enhancement to the numerics calculations. The currently rule of > summing the scale of the types involved in muls/divs is very bad and > can easily cause overflow. Maybe FB could automatically truncate the > result to the maximum precision possible to accommodate the final > value. Even better if the truncation happens only in the final result > (not during the internal calculations).
This behavior is defined in the SQL standard (SQL:2011 Foundation, section 6.27) for multiplication (see sub c), with division we can choose (see sub d): 1) If the declared type of both operands of a dyadic arithmetic operator is exact numeric, then the declared type of the result is an implementation-defined exact numeric type, with precision and scale determined as follows: a) Let S1 and S2 be the scale of the first and second operands respectively. b) The precision of the result of addition and subtraction is implementation-defined, and the scale is the maximum of S1 and S2. c) **The precision of the result of multiplication is implementation-defined, and the scale is S1 + S2**. d) The precision and scale of the result of division are implementation-defined. I'd suggest that instead the maximum precision of DECIMAL and NUMERIC should be increased. Mark -- Mark Rotteveel ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available. Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel