Sophocles,
have you tried the fuzziness parameter? Maybe this is what you are looking
for:
#include <oxstd.h>
main()
{
decl ca, cb;
ca = 1*10*exp(-10);
cb = 2*10*exp(-10);
if(iseq(ca, cb)) print("\nequal");
else print("\nnot equal");
fuzziness(1*10*exp(-5));
if(isfeq(ca, cb)) print("\nfuzzy equal");
else print("\nnot fuzzy equal");
}
______________________________________________
Michael Massmann
NIESR and Lincoln College, Oxford
mail: NIESR, 2 Dean Trench St, London SW1P 3HE
phone: 0207 654 1933
fax: 0207 654 1900
email: [log in to unmask]
---------- Forwarded message ----------
Date: Wed, 21 Nov 2001 11:59:34 -0000
From: Sophocles Mavroeidis <[log in to unmask]>
To: [log in to unmask]
Subject: IsEqual?
Does anyone know of a standard function in Ox that compares two arithmetic
types
and checks whether they are "equal", up to a given degree of numerical
precision?
e.g.
(ma - mb)'(ma-mb) = -8.8435e-010
would produce ma == mb or iseq(ma, mb) = FALSE.
Is there something that gets round this numerical problem?
(I've got my own function doing that, but I wonder whether there is already
one in the Ox function library)
Thanks,
Sophocles
|