From 8f89d908656122033909033a7a71c87636319a08 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Thu, 5 Sep 2013 11:33:07 +0000 Subject: [PATCH] math: correct-rounding check in remainder functions and 1ulp check in hypot --- src/math/fmod.c | 2 +- src/math/fmodf.c | 2 +- src/math/fmodl.c | 2 +- src/math/hypot.c | 2 +- src/math/hypotf.c | 2 +- src/math/hypotl.c | 2 +- src/math/remainder.c | 2 +- src/math/remainderf.c | 2 +- src/math/remainderl.c | 2 +- src/math/remquo.c | 2 +- src/math/remquof.c | 2 +- src/math/remquol.c | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/math/fmod.c b/src/math/fmod.c index 3ba4427..76c2634 100644 --- a/src/math/fmod.c +++ b/src/math/fmod.c @@ -34,7 +34,7 @@ int main(void) err++; } d = ulperr(y, p->y, p->dy); - if (!checkulp(d, p->r)) { + if (!checkcr(y, p->y, p->r)) { printf("%s:%d: %s fmod(%a,%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); err++; diff --git a/src/math/fmodf.c b/src/math/fmodf.c index 9a4aa52..1a70350 100644 --- a/src/math/fmodf.c +++ b/src/math/fmodf.c @@ -34,7 +34,7 @@ int main(void) err++; } d = ulperrf(y, p->y, p->dy); - if (!checkulp(d, p->r)) { + if (!checkcr(y, p->y, p->r)) { printf("%s:%d: %s fmodf(%a,%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); err++; diff --git a/src/math/fmodl.c b/src/math/fmodl.c index e10cd8a..3dd7f4f 100644 --- a/src/math/fmodl.c +++ b/src/math/fmodl.c @@ -40,7 +40,7 @@ int main(void) err++; } d = ulperrl(y, p->y, p->dy); - if (!checkulp(d, p->r)) { + if (!checkcr(y, p->y, p->r)) { printf("%s:%d: %s fmodl(%La,%La) want %La got %La ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); err++; diff --git a/src/math/hypot.c b/src/math/hypot.c index 9890ed4..8c40b97 100644 --- a/src/math/hypot.c +++ b/src/math/hypot.c @@ -34,7 +34,7 @@ int main(void) err++; } d = ulperr(y, p->y, p->dy); - if (!checkulp(d, p->r)) { + if (!checkulp(d, p->r) || (p->r == RN && fabs(d) >= 1.0)) { printf("%s:%d: %s hypot(%a,%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); err++; diff --git a/src/math/hypotf.c b/src/math/hypotf.c index bd5830b..19d8525 100644 --- a/src/math/hypotf.c +++ b/src/math/hypotf.c @@ -34,7 +34,7 @@ int main(void) err++; } d = ulperrf(y, p->y, p->dy); - if (!checkulp(d, p->r)) { + if (!checkulp(d, p->r) || (p->r == RN && fabs(d) >= 1.0)) { printf("%s:%d: %s hypotf(%a,%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); err++; diff --git a/src/math/hypotl.c b/src/math/hypotl.c index 27ca819..cae06dd 100644 --- a/src/math/hypotl.c +++ b/src/math/hypotl.c @@ -40,7 +40,7 @@ int main(void) err++; } d = ulperrl(y, p->y, p->dy); - if (!checkulp(d, p->r)) { + if (!checkulp(d, p->r) || (p->r == RN && fabs(d) >= 1.0)) { printf("%s:%d: %s hypotl(%La,%La) want %La got %La ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); err++; diff --git a/src/math/remainder.c b/src/math/remainder.c index f8278ba..2debbb7 100644 --- a/src/math/remainder.c +++ b/src/math/remainder.c @@ -33,7 +33,7 @@ int main(void) err++; } d = ulperr(y, p->y, p->dy); - if (!checkulp(d, p->r)) { + if (!checkcr(y, p->y, p->r)) { printf("%s:%d: %s remainder(%a,%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); err++; diff --git a/src/math/remainderf.c b/src/math/remainderf.c index a06f2bd..a648b04 100644 --- a/src/math/remainderf.c +++ b/src/math/remainderf.c @@ -33,7 +33,7 @@ int main(void) err++; } d = ulperrf(y, p->y, p->dy); - if (!checkulp(d, p->r)) { + if (!checkcr(y, p->y, p->r)) { printf("%s:%d: %s remainderf(%a,%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); err++; diff --git a/src/math/remainderl.c b/src/math/remainderl.c index 83cedc1..b028519 100644 --- a/src/math/remainderl.c +++ b/src/math/remainderl.c @@ -39,7 +39,7 @@ int main(void) err++; } d = ulperrl(y, p->y, p->dy); - if (!checkulp(d, p->r)) { + if (!checkcr(y, p->y, p->r)) { printf("%s:%d: %s remainderl(%La,%La) want %La got %La ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); err++; diff --git a/src/math/remquo.c b/src/math/remquo.c index afcab78..8694688 100644 --- a/src/math/remquo.c +++ b/src/math/remquo.c @@ -33,7 +33,7 @@ int main(void) err++; } d = ulperr(y, p->y, p->dy); - if (!checkulp(d, p->r) || + if (!checkcr(y, p->y, p->r) || (!isnan(p->y) && (yi & 7) != (p->i & 7)) || (!isnan(p->y) && (yi < 0) != (p->i < 0))) { printf("%s:%d: %s remquo(%a,%a) want %a,%lld got %a,%d ulperr %.3f = %a + %a\n", diff --git a/src/math/remquof.c b/src/math/remquof.c index f27402a..46cc9d5 100644 --- a/src/math/remquof.c +++ b/src/math/remquof.c @@ -33,7 +33,7 @@ int main(void) err++; } d = ulperr(y, p->y, p->dy); - if (!checkulp(d, p->r) || + if (!checkcr(y, p->y, p->r) || (!isnan(p->y) && (yi & 7) != (p->i & 7)) || (!isnan(p->y) && (yi < 0) != (p->i < 0))) { printf("%s:%d: %s remquof(%a,%a) want %a,%lld got %a,%d ulperr %.3f = %a + %a\n", diff --git a/src/math/remquol.c b/src/math/remquol.c index 257b044..cf64126 100644 --- a/src/math/remquol.c +++ b/src/math/remquol.c @@ -33,7 +33,7 @@ int main(void) err++; } d = ulperr(y, p->y, p->dy); - if (!checkulp(d, p->r) || + if (!checkcr(y, p->y, p->r) || (!isnan(p->y) && (yi & 7) != (p->i & 7)) || (!isnan(p->y) && (yi < 0) != (p->i < 0))) { printf("%s:%d: %s remquol(%La,%La) want %La,%lld got %La,%d ulperr %.3f = %a + %a\n", -- 2.20.1