flt_modf.c 705 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. (c) copyright 1989 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* $Id$ */
  6. #include "flt_misc.h"
  7. void
  8. flt_modf(e, ipart, fpart)
  9. register flt_arith *e, *ipart, *fpart;
  10. {
  11. if (e->flt_exp < 0) {
  12. *fpart = *e;
  13. ipart->flt_sign = 0;
  14. ipart->flt_exp = 0;
  15. ipart->m1 = ipart->m2 = 0;
  16. return;
  17. }
  18. if (e->flt_exp >= 63) {
  19. fpart->flt_sign = 0;
  20. fpart->flt_exp = 0;
  21. fpart->m1 = fpart->m2 = 0;
  22. *ipart = *e;
  23. return;
  24. }
  25. *ipart = *e;
  26. /* "loose" low order bits */
  27. flt_b64_sft(&(ipart->flt_mantissa), 63 - e->flt_exp);
  28. flt_b64_sft(&(ipart->flt_mantissa), e->flt_exp - 63);
  29. flt_sub(e, ipart, fpart);
  30. }