X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fremainderf.c;h=93fd1a3645d069efd4ab7141da950aedf64ccb59;hb=9655379852fdbf3a0797035fc30a4060a2b191cf;hp=d75cf2d39e0920e347a527745bf4cb55571fe754;hpb=7feced3510dfaaeceba87eac4d5140977943e66d;p=gnulib.git diff --git a/lib/remainderf.c b/lib/remainderf.c index d75cf2d39..93fd1a364 100644 --- a/lib/remainderf.c +++ b/lib/remainderf.c @@ -19,32 +19,17 @@ /* Specification. */ #include +#if HAVE_REMAINDER + float remainderf (float x, float y) { -#if HAVE_REMAINDER return (float) remainder ((double) x, (double) y); +} + #else - float q = - roundf (x / y); - float r = fmaf (q, y, x); /* = x + q * y, computed in one step */ - /* Correct possible rounding errors in the quotient x / y. */ - float half_y = 0.5L * y; - if (y >= 0) - { - /* Expect -y/2 <= r <= y/2. */ - if (r > half_y) - q -= 1, r = fmaf (q, y, x); - else if (r < - half_y) - q += 1, r = fmaf (q, y, x); - } - else - { - /* Expect y/2 <= r <= -y/2. */ - if (r > - half_y) - q += 1, r = fmaf (q, y, x); - else if (r < half_y) - q -= 1, r = fmaf (q, y, x); - } - return r; + +# define USE_FLOAT +# include "remainder.c" + #endif -}