libc/stdio/_scanf.c: heed lots of warnings about signed/unsigned chars
[uclibc-ng.git] / libm / s_remquo.c
blob9cbf8c4abab8ecae14ad5407e7bc0282bfb97645
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 "math.h"
8 #include "math_private.h"
10 #ifdef __STDC__
11 double remquo(double x, double y, int *quo) /* wrapper remquo */
12 #else
13 double remquo(x,y,quo) /* wrapper remquo */
14 double x,y;
15 int *quo;
16 #endif
18 int signx, signy, signres;
19 int mswx;
20 int mswy;
21 double x_over_y;
23 GET_HIGH_WORD(mswx, x);
24 GET_HIGH_WORD(mswy, y);
26 signx = (mswx & 0x80000000) >> 31;
27 signy = (mswy & 0x80000000) >> 31;
29 signres = (signx ^ signy) ? -1 : 1;
31 x_over_y = fabs(x / y);
33 *quo = signres * (lrint(x_over_y) & 0x7f);
35 return remainder(x,y);
37 libm_hidden_def(remquo)