Victor,

Actually, Real has twice as many bytes to store the value, which doesn't mean it is 
twice as accurate, it means it is 2 to the 16th power or over 64000 times more 
accurate. 

Since DOUBLE was "invented", I have never used REAL, because it is so incredibly 
limited and susceptible to roundoff errors.  It can only be accurate to six display 
digits, and it will compound rounding errors at the boundaries (like 3.50) at fewer 
digits than that.

Bill

On 23 Jun 2004 at 11:08, Victor Timmons wrote:

> I am doing a very simple formula that does some rounding.
> 
> R>SET VAR vUpdateAmount REAL = .01
> R>SET VAR vBookListPrice CURRENCY = 3.50
> R>SET VAR vBookListPrice2 DOUBLE = NULL
> R>SET VAR vBookListPrice2 = .vBookListPrice
> R>SET VAR vBookListPrice2 = ((.vBookListPrice2 *  
> .vUpdateAmount)+.vBookListPrice2)
> R>SHO VAR vBookListPrice2
>      3.5399999921769
> R>SET VAR vBookListPrice2 = (ROUND(.vBookListPrice2,2))
> R>SHO VAR vBookListPrice2
>      3.53
> 
> If I change vUpdateAmount to a DOUBLE I get the correct results 3.54
> Why is that?? Isnt .01 = .01 wheather is a REAL or a DOUBLE?? Could
> someone run this a let me know if they get the same results?
> 
> R>SET VAR vUpdateAmount DOUBLE = .01
> R>SET VAR vBookListPrice CURRENCY = 3.50
> R>SET VAR vBookListPrice2 DOUBLE = NULL
> R>SET VAR vBookListPrice2 = .vBookListPrice
> R>SET VAR vBookListPrice2 = ((.vBookListPrice2 *  
> .vUpdateAmount)+.vBookListPrice2)
> R>SHO VAR vBookListPrice2
>      3.535
> R>SET VAR vBookListPrice2 = (ROUND(.vBookListPrice2,2))
> R>SHO VAR vBookListPrice2
>      3.54
> 
> 
> 
> 
> Victor Timmons        
> Tiz's Door Sales, Inc
> 425-258-2391

Reply via email to