From 7095366d1efc6e58639f7c76d0b515212d61247d Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 26 Apr 2009 03:43:02 +0000 Subject: * math/w_fmod.c: Also handle x=±Inf as error. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * math/w_fmodf.c: Likewise. * math/w_fmodl.c: Likewise. * math/libm-test.inc (fmod_test): Add tests for errno after calls for x=±Inf or y=0. --- math/w_fmod.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'math/w_fmod.c') diff --git a/math/w_fmod.c b/math/w_fmod.c index 43a1d8ef5c..ca01cf2ac5 100644 --- a/math/w_fmod.c +++ b/math/w_fmod.c @@ -35,8 +35,9 @@ static char rcsid[] = "$NetBSD: w_fmod.c,v 1.6 1995/05/10 20:48:55 jtc Exp $"; double z; z = __ieee754_fmod(x,y); if(_LIB_VERSION == _IEEE_ ||__isnan(y)||__isnan(x)) return z; - if(y==0.0) { - return __kernel_standard(x,y,27); /* fmod(x,0) */ + if(__isinf(x)||y==0.0) { + /* fmod(+-Inf,y) or fmod(x,0) */ + return __kernel_standard(x,y,27); } else return z; #endif -- cgit v1.2.3-70-g09d2