fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libm / math / wf_remainder.c
blob0071a97721912bb6f1dea5a89b1578dab214b65c
1 /* wf_remainder.c -- float version of w_remainder.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3 */
5 /*
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
12 * is preserved.
13 * ====================================================
16 /*
17 * wrapper remainderf(x,p)
20 #include "fdlibm.h"
21 #include <errno.h>
23 #ifdef __STDC__
24 float remainderf(float x, float y) /* wrapper remainder */
25 #else
26 float remainderf(x,y) /* wrapper remainder */
27 float x,y;
28 #endif
30 #ifdef _IEEE_LIBM
31 return __ieee754_remainderf(x,y);
32 #else
33 float z;
34 struct exception exc;
35 z = __ieee754_remainderf(x,y);
36 if(_LIB_VERSION == _IEEE_ || isnanf(y)) return z;
37 if(y==(float)0.0) {
38 /* remainderf(x,0) */
39 exc.type = DOMAIN;
40 exc.name = "remainderf";
41 exc.err = 0;
42 exc.arg1 = (double)x;
43 exc.arg2 = (double)y;
44 exc.retval = 0.0/0.0;
45 if (_LIB_VERSION == _POSIX_)
46 errno = EDOM;
47 else if (!matherr(&exc)) {
48 errno = EDOM;
50 if (exc.err != 0)
51 errno = exc.err;
52 return (float)exc.retval;
53 } else
54 return z;
55 #endif
58 #ifdef _DOUBLE_IS_32BITS
60 #ifdef __STDC__
61 double remainder(double x, double y)
62 #else
63 double remainder(x,y)
64 double x,y;
65 #endif
67 return (double) remainderf((float) x, (float) y);
70 #endif /* defined(_DOUBLE_IS_32BITS) */