[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Numeric Vars



You case is common for any language that manipulate numerics.
when these numeric are float (not integer) the equality is never garantee.
In scientific environnement we use these fomula to compare two real number
if ( (X1 - x2)< Epsilon)
 then equal is true
 else false
fi

and epsilon is set to the precision of your computer and this value will
depend mostly of  your processor.

in your case you can position epsilon to 0.000001 if this precisioon is
sufficient.

Franck,

-----Original Message-----
From: Discussion of SQR, Brio Technology's database reporting language
[mailto:SQR-USERS@list.iex.net]On Behalf Of Bill Beckner
Sent: jeudi 12 juillet 2001 18:13
To: SQR-USERS@list.iex.net
Subject: Numeric Vars


Here's a puzzle for all you SQR experts....

I've got these two numeric variables, assigned the same amount, and I
display their values like this:

    SHOW '#New_Posted_amt ' #New_Posted_amt
    SHOW '#Ttl_Proj_Amt2  ' #Ttl_Proj_Amt2

And the following shows in the sqr.log:

    #New_Posted_amt 12696.840000
    #Ttl_Proj_Amt2  12696.840000

When the following comparison is performed:

    if #New_Posted_amt > #Ttl_Proj_Amt2
        do Print-Error-Message
    end-if

I always get an error message!!!  Any ideas?  We're using SQR 4.3.4

Thanks!!!

Why does SQR

--
William Beckner -- Stunt Programmer (Just call me "Bill")
Illinois Central College, Rm L141 -- East Peoria, IL  61635-0001
PH: (309) 694-8419 -- FAX: (309) 694-8995
"An unfinished thought is like a day without..."