summaryrefslogtreecommitdiff
path: root/src/elementaryFunctions/floor/testDoubleFloor.c
diff options
context:
space:
mode:
authortorset2009-02-27 13:30:30 +0000
committertorset2009-02-27 13:30:30 +0000
commit05fb6a62c83ae7cea37aa2795e61697b3560f135 (patch)
treee4135e36ec029b677faeb18125b19fa4a6d11a6c /src/elementaryFunctions/floor/testDoubleFloor.c
parent3ce979f5740261766f4248864c0758d6cb6af857 (diff)
downloadscilab2c-05fb6a62c83ae7cea37aa2795e61697b3560f135.tar.gz
scilab2c-05fb6a62c83ae7cea37aa2795e61697b3560f135.tar.bz2
scilab2c-05fb6a62c83ae7cea37aa2795e61697b3560f135.zip
change precision for tests : put it to 3e-16 for double and 3e-6 for float
Diffstat (limited to 'src/elementaryFunctions/floor/testDoubleFloor.c')
-rw-r--r--src/elementaryFunctions/floor/testDoubleFloor.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/elementaryFunctions/floor/testDoubleFloor.c b/src/elementaryFunctions/floor/testDoubleFloor.c
index 186aba95..71e0b36f 100644
--- a/src/elementaryFunctions/floor/testDoubleFloor.c
+++ b/src/elementaryFunctions/floor/testDoubleFloor.c
@@ -20,25 +20,25 @@
static void dfloorsTest(void) {
assert ((fabs( dfloors(-2) - (-2))/fabs(dfloors(-2)))<1e-16);
assert ((fabs( dfloors(-1.9) - (-2))/fabs(dfloors(-1.9)))<1e-16);
- assert ((fabs( dfloors(-1.8) - (-2))/fabs(dfloors(-1.9)))<1e-16);
- assert ((fabs( dfloors(-1.7) - (-2))/fabs(dfloors(-1.9)))<1e-16);
- assert ((fabs( dfloors(-1.6) - (-2))/fabs(dfloors(-1.9)))<1e-16);
- assert ((fabs( dfloors(-1.5) - (-2))/fabs(dfloors(-1.9)))<1e-16);
- assert ((fabs( dfloors(-1.4) - (-2))/fabs(dfloors(-1.9)))<1e-16);
- assert ((fabs( dfloors(-1.3) - (-2))/fabs(dfloors(-1.9)))<1e-16);
- assert ((fabs( dfloors(-1.2) - (-2))/fabs(dfloors(-1.9)))<1e-16);
- assert ((fabs( dfloors(-1.1) - (-2))/fabs(dfloors(-1.9)))<1e-16);
- assert ((fabs( dfloors(-1.0) - (-1))/fabs(dfloors(-1.9)))<1e-16);
- assert ((fabs( dfloors(-0.9) - (-1))/fabs(dfloors(-1.9)))<1e-16);
- assert ((fabs( dfloors(1.0) - (1))/fabs(dfloors(1.9)))<1e-16);
- assert ((fabs( dfloors(1.1) - (1))/fabs(dfloors(1.9)))<1e-16);
- assert ((fabs( dfloors(1.2) - (1))/fabs(dfloors(1.9)))<1e-16);
- assert ((fabs( dfloors(1.3) - (1))/fabs(dfloors(1.9)))<1e-16);
- assert ((fabs( dfloors(1.4) - (1))/fabs(dfloors(1.9)))<1e-16);
- assert ((fabs( dfloors(1.5) - (1))/fabs(dfloors(1.9)))<1e-16);
- assert ((fabs( dfloors(1.6) - (1))/fabs(dfloors(1.9)))<1e-16);
- assert ((fabs( dfloors(1.7) - (1))/fabs(dfloors(1.9)))<1e-16);
- assert ((fabs( dfloors(1.8) - (1))/fabs(dfloors(1.9)))<1e-16);
+ assert ((fabs( dfloors(-1.8) - (-2))/fabs(dfloors(-1.8)))<1e-16);
+ assert ((fabs( dfloors(-1.7) - (-2))/fabs(dfloors(-1.7)))<1e-16);
+ assert ((fabs( dfloors(-1.6) - (-2))/fabs(dfloors(-1.6)))<1e-16);
+ assert ((fabs( dfloors(-1.5) - (-2))/fabs(dfloors(-1.5)))<1e-16);
+ assert ((fabs( dfloors(-1.4) - (-2))/fabs(dfloors(-1.4)))<1e-16);
+ assert ((fabs( dfloors(-1.3) - (-2))/fabs(dfloors(-1.3)))<1e-16);
+ assert ((fabs( dfloors(-1.2) - (-2))/fabs(dfloors(-1.2)))<1e-16);
+ assert ((fabs( dfloors(-1.1) - (-2))/fabs(dfloors(-1.1)))<1e-16);
+ assert ((fabs( dfloors(-1.0) - (-1))/fabs(dfloors(-1.0)))<1e-16);
+ assert ((fabs( dfloors(-0.9) - (-1))/fabs(dfloors(-0.9)))<1e-16);
+ assert ((fabs( dfloors(1.0) - (1))/fabs(dfloors(1.0)))<1e-16);
+ assert ((fabs( dfloors(1.1) - (1))/fabs(dfloors(1.1)))<1e-16);
+ assert ((fabs( dfloors(1.2) - (1))/fabs(dfloors(1.2)))<1e-16);
+ assert ((fabs( dfloors(1.3) - (1))/fabs(dfloors(1.3)))<1e-16);
+ assert ((fabs( dfloors(1.4) - (1))/fabs(dfloors(1.4)))<1e-16);
+ assert ((fabs( dfloors(1.5) - (1))/fabs(dfloors(1.5)))<1e-16);
+ assert ((fabs( dfloors(1.6) - (1))/fabs(dfloors(1.6)))<1e-16);
+ assert ((fabs( dfloors(1.7) - (1))/fabs(dfloors(1.7)))<1e-16);
+ assert ((fabs( dfloors(1.8) - (1))/fabs(dfloors(1.8)))<1e-16);
assert ((fabs( dfloors(1.9) - (1))/fabs(dfloors(1.9)))<1e-16);
assert ((fabs( dfloors(2.0) - (2))/fabs(dfloors(2.0)))<1e-16);
@@ -110,9 +110,9 @@ static void dflooraTest(void) {
dfloora(in,10,out);
- for (i=0;i<10;i++) assert(fabs(out[i]-res[i]) <1e-16);
-
-
+ for (i=0;i<10;i++)
+ if (out[i]!=0) assert(fabs(out[i]-res[i])/fabs(out[i]) < 1e-16);
+ else assert(fabs(out[i]-res[i]) <1e-16);
}
static void zflooraTest(void) {
@@ -127,8 +127,10 @@ static void zflooraTest(void) {
zfloora(in,10,out);
for (i=0;i<10;i++){
- assert(fabs(zreals(out[i])-resR[i]) <1e-16);
- assert(fabs(zimags(out[i])-resI[i]) <1e-16);
+ if (zreals(out[i])!=0) assert( fabs(zreals(out[i])-resR[i])/fabs(zreals(out[i])) < 1e-16);
+ else assert(fabs(zreals(out[i])-resR[i]) <1e-16);
+ if (zimags(out[i])!=0) assert( fabs(zimags(out[i])-resI[i])/fabs(zimags(out[i])) < 1e-16);
+ else assert(fabs(zimags(out[i])-resI[i]) <1e-16);
}
}