X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Ffmodl.c;h=8a9636f8378a995f0cb13150c07ee441f9e83840;hb=5191b3546cfb6c163228c23f214e325ddf60d46f;hp=a7ccd8bcd582bc666190a3707ce4ff81507a0432;hpb=0e1c6ff93f27c939ba9e0df945b16ef98eaaeef1;p=gnulib.git diff --git a/lib/fmodl.c b/lib/fmodl.c index a7ccd8bcd..8a9636f83 100644 --- a/lib/fmodl.c +++ b/lib/fmodl.c @@ -1,5 +1,5 @@ /* Remainder. - Copyright (C) 2011-2012 Free Software Foundation, Inc. + Copyright (C) 2011-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,51 +29,7 @@ fmodl (long double x, long double y) #else -long double -fmodl (long double x, long double y) -{ - long double q = - truncl (x / y); - long double r = fmal (q, y, x); /* = x + q * y, computed in one step */ - /* Correct possible rounding errors in the quotient x / y. */ - if (y >= 0) - { - if (x >= 0) - { - /* Expect 0 <= r < y. */ - if (r < 0) - q += 1, r = fmal (q, y, x); - else if (r >= y) - q -= 1, r = fmal (q, y, x); - } - else - { - /* Expect - y < r <= 0. */ - if (r > 0) - q -= 1, r = fmal (q, y, x); - else if (r <= - y) - q += 1, r = fmal (q, y, x); - } - } - else - { - if (x >= 0) - { - /* Expect 0 <= r < - y. */ - if (r < 0) - q -= 1, r = fmal (q, y, x); - else if (r >= - y) - q += 1, r = fmal (q, y, x); - } - else - { - /* Expect y < r <= 0. */ - if (r > 0) - q += 1, r = fmal (q, y, x); - else if (r <= y) - q -= 1, r = fmal (q, y, x); - } - } - return r; -} +# define USE_LONG_DOUBLE +# include "fmod.c" #endif