s_ldexp.c 909 B

12345678910111213141516171819202122232425262728293031323334
  1. #if !defined(__ppc__)
  2. /* @(#)s_ldexp.c 5.1 93/09/24 */
  3. /*
  4. * ====================================================
  5. * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  6. *
  7. * Developed at SunPro, a Sun Microsystems, Inc. business.
  8. * Permission to use, copy, modify, and distribute this
  9. * software is freely granted, provided that this notice
  10. * is preserved.
  11. * ====================================================
  12. */
  13. #if defined(LIBM_SCCS) && !defined(lint)
  14. static char rcsid[] = "$NetBSD: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $";
  15. #endif
  16. #include "math.h"
  17. #include "math_private.h"
  18. #include <errno.h>
  19. #ifdef __STDC__
  20. double ldexp(double value, int exp)
  21. #else
  22. double ldexp(value, exp)
  23. double value; int exp;
  24. #endif
  25. {
  26. if(!finite(value)||value==0.0) return value;
  27. value = scalbn(value,exp);
  28. if(!finite(value)||value==0.0) errno = ERANGE;
  29. return value;
  30. }
  31. #endif /* !__ppc__ */