fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libm / common / sf_remquo.c
blob41c2038d4e79667cd4612c58fa286ed28da1e34e
1 /* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
3 * Permission to use, copy, modify, and distribute this software
4 * is freely granted, provided that this notice is preserved.
5 */
7 #include "fdlibm.h"
9 #ifdef __STDC__
10 float remquof(float x, float y, int *quo) /* wrapper remquof */
11 #else
12 float remquof(x,y,quo) /* wrapper remquof */
13 float x,y;
14 int *quo;
15 #endif
17 int signx, signy, signres;
18 int wx;
19 int wy;
20 float x_over_y;
22 GET_FLOAT_WORD(wx, x);
23 GET_FLOAT_WORD(wy, y);
25 signx = (wx & 0x80000000) >> 31;
26 signy = (wy & 0x80000000) >> 31;
28 signres = (signx ^ signy) ? -1 : 1;
30 x_over_y = fabsf(x / y);
32 *quo = signres * (lrintf(x_over_y) & 0x7f);
34 return remainderf(x,y);
37 #ifdef _DOUBLE_IS_32BITS
39 #ifdef __STDC__
40 double remquo(double x, double y, int *quo) /* wrapper remquof */
41 #else
42 double remquo(x,y,quo) /* wrapper remquof */
43 double x,y;
44 int *quo;
45 #endif
47 return (double) remquof((float) x, (float) y, quo);
50 #endif /* defined(_DOUBLE_IS_32BITS) */