s_ldexp.c 649 B

1234567891011121314151617181920212223
  1. /*
  2. * ====================================================
  3. * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  4. *
  5. * Developed at SunPro, a Sun Microsystems, Inc. business.
  6. * Permission to use, copy, modify, and distribute this
  7. * software is freely granted, provided that this notice
  8. * is preserved.
  9. * ====================================================
  10. */
  11. #include "math.h"
  12. #include "math_private.h"
  13. #include <errno.h>
  14. double ldexp(double value, int exp)
  15. {
  16. if(!isfinite(value)||value==0.0) return value;
  17. value = scalbn(value,exp);
  18. if(!isfinite(value)||value==0.0) errno = ERANGE;
  19. return value;
  20. }
  21. libm_hidden_def(ldexp)