s_remquo.c 753 B

12345678910111213141516171819202122232425262728293031
  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. #include "math.h"
  7. #include "math_private.h"
  8. double remquo(double x, double y, int *quo) /* wrapper remquo */
  9. {
  10. int signx, signy, signres;
  11. int mswx;
  12. int mswy;
  13. double x_over_y;
  14. GET_HIGH_WORD(mswx, x);
  15. GET_HIGH_WORD(mswy, y);
  16. signx = (mswx & 0x80000000) >> 31;
  17. signy = (mswy & 0x80000000) >> 31;
  18. signres = (signx ^ signy) ? -1 : 1;
  19. x_over_y = fabs(x / y);
  20. *quo = signres * (lrint(x_over_y) & 0x7f);
  21. return remainder(x,y);
  22. }
  23. libm_hidden_def(remquo)