Javier,

This is not the same as the other rounding issues that have been 
discussed. Your problem stems from the very low precision available in 
the REAL data type. You should use DOUBLE.  

I would also recommend that you do your computations in the 
DOUBLE datatype, then cast that answer into currency, rather than 
rounding directly into currency:

-- this works:
SET V v1 CURRENCY = 11 
SET V v2 DOUBLE = .83 
SET V v3 CURRENCY 
SET V v3 = (.v1 * .v2 * 1.5)  -- = 13.70

-- this works, and gives you better protection against
-- data type conversion precision problems
SET V v1 CURRENCY = 11 
SET V v2 DOUBLE = .83 
SET V v4 DOUBLE
SET V v4 = (.v1 * .v2 * 1.5)  
SET VAR v3 CURRENCY
SET VAR v3 = (.v4)

Bill




On Sun, 9 Feb 2003 23:12:43 -0600, Javier Valencia wrote:

>Using REAL numbers (instead of currency) as follows& 
>
>(11 * .83  * 1.5) = 13.695, which should round up to $13.70. 
>
>  

Reply via email to