| lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /* Copyright (C) 2002 by  Red Hat, Incorporated. All rights reserved. | 
 | 2 |  * | 
 | 3 |  * Permission to use, copy, modify, and distribute this software | 
 | 4 |  * is freely granted, provided that this notice is preserved. | 
 | 5 |  */ | 
 | 6 |  | 
 | 7 | #include "math.h" | 
 | 8 | #include "math_private.h" | 
 | 9 |  | 
 | 10 | double remquo(double x, double y, int *quo)	/* wrapper remquo */ | 
 | 11 | { | 
 | 12 |         int signx, signy, signres; | 
 | 13 |         int mswx; | 
 | 14 |         int mswy; | 
 | 15 |         double x_over_y; | 
 | 16 |  | 
 | 17 |         GET_HIGH_WORD(mswx, x); | 
 | 18 |         GET_HIGH_WORD(mswy, y); | 
 | 19 |  | 
 | 20 |         signx = (mswx & 0x80000000) >> 31; | 
 | 21 |         signy = (mswy & 0x80000000) >> 31; | 
 | 22 |  | 
 | 23 |         signres = (signx ^ signy) ? -1 : 1; | 
 | 24 |  | 
 | 25 |         x_over_y = fabs(x / y); | 
 | 26 |  | 
 | 27 |         *quo = signres * (lrint(x_over_y) & 0x7f); | 
 | 28 |  | 
 | 29 |         return remainder(x,y); | 
 | 30 | } | 
 | 31 | libm_hidden_def(remquo) |