1 /* e_remainderf.c -- float version of e_remainder.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
13 * ====================================================
15 * $NetBSD: e_remainderf.c,v 1.7 2002/05/26 22:01:52 wiz Exp $
16 * $DragonFly: src/lib/libm/src/e_remainderf.c,v 1.1 2005/07/26 21:15:20 joerg Exp $
20 #include "math_private.h"
22 static const float zero = 0.0;
26 remainderf(float x, float p)
38 /* purge off exception values */
39 if(hp==0) return (x*p)/(x*p); /* p = 0 */
40 if((hx>=0x7f800000)|| /* x not finite */
41 ((hp>0x7f800000))) /* p is NaN */
45 if (hp<=0x7effffff) x = fmodf(x,p+p); /* now x < 2p */
46 if ((hx-hp)==0) return zero*x;
55 p_half = (float)0.5*p;
62 SET_FLOAT_WORD(x,hx^sx);