Perhaps superior but somewhat late--what would one do prior to 4.73.0?
-----Original
Message-----
From: amibroker@xxxxxxxxxxxxxxx
[mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf
Of Tomasz Janeczko
Sent: Thursday, January 26, 2006
1:22 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Nearly
Equal or is it Fuzzy Math
AlmostEqual
function is superior solution.
Best regards,
Tomasz Janeczko
amibroker.com
-----
Original Message -----
To: amibroker@xxxxxxxxxxxxxxx
Sent: Thursday, January 26,
2006 4:01 AM
Subject: RE:
[amibroker] Nearly Equal or is it Fuzzy Math
The old saw is to always
use >= or <= with floats.
Bob
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx
[mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf
Of Tomasz Janeczko
Sent: Tuesday, January 24, 2006
8:44 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Nearly
Equal or is it Fuzzy Math
AlmostEqual()
- it is in the read me.
AlmostEqual(
x, y, ulps = 5 )
this is a helper function for comparing floating point numbers.It returns True
if x and y are equal or almost equal upto defined accurracy (ulps).It is
recommended to use this function instead of equality check (==) as itleads to
more reliable comparisons and less headache caused by IEEE floating pointacurracy
issues.
Parameters:x, y - the numbers or arrays to be compared,Ulps stands for
"units in last place" and represents maximum relative error of the
comparison. Since 32 bit IEEE floating point numbers have accurracy of 7
significant digits, 1 unit in last place(ulp) represents relative error of
0.00001 %. The default value of ulps parameter is 5 which gives roughtly
0.00005% "comparison sensitivity".
Example code:
if( 1/3 == 0.3333333 )
{
printf("32-bit Floating point IEEE exact equality\n");
}
if( AlmostEqual( 1/3, 0.3333333 ) )
{
printf("Numbers are almost equal\n");
}
HINT
FOR THE FUTURE:
At
any time if you forgot the name, just type space and then press CTRL+SPACE keys
in the AFL editor and you will see the list of all keywords.
Best regards,
Tomasz Janeczko
amibroker.com
-----
Original Message -----
To: amibroker@xxxxxxxxxxxxxxx
Sent: Tuesday, January 24,
2006 2:57 PM
Subject:
[amibroker] Nearly Equal or is it Fuzzy Math
I thought
Tomasz had added a function where one could compare two
numbers and
get a TRUE indicator even when the last bit of floating
point number did
not agree.
I've search the on list of functions and can't seem to find that
function or a
discussion out it.
Anyone recall
what that function is called?
Thanks
Joe
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
YAHOO! GROUPS LINKS