home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Science / Science.zip / gmt_os2.zip / src / math / s_ldexp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-16  |  714 b   |  29 lines

  1.  
  2. /* @(#)s_ldexp.c 1.3 95/01/18 */
  3. /*
  4.  * ====================================================
  5.  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  6.  *
  7.  * Developed at SunSoft, 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.  
  14. #include "fdlibm.h"
  15. #include <errno.h>
  16.  
  17. #ifdef __STDC__
  18.     double ldexp(double value, int exp)
  19. #else
  20.     double ldexp(value, exp)
  21.     double value; int exp;
  22. #endif
  23. {
  24.     if(!finite(value)||value==0.0) return value;
  25.     value = scalbn(value,exp);
  26.     if(!finite(value)||value==0.0) errno = ERANGE;
  27.     return value;
  28. }
  29.