1 /* $OpenBSD: s_scalbln.c,v 1.1 2009/07/25 11:38:10 martynas Exp $ */ 2 3 /* 4 * Written by Martynas Venckus. Public domain 5 */ 6 7 #include <limits.h> 8 #include <math.h> 9 10 double 11 scalbln(double x, long n) 12 { 13 if (n < INT_MIN) 14 return scalbn(x, INT_MIN); 15 else if (n > INT_MAX) 16 return scalbn(x, INT_MAX); 17 else 18 return scalbn(x, (int)n); 19 } 20 21 float 22 scalblnf(float x, long n) 23 { 24 if (n < INT_MIN) 25 return scalbnf(x, INT_MIN); 26 else if (n > INT_MAX) 27 return scalbnf(x, INT_MAX); 28 else 29 return scalbnf(x, (int)n); 30 } 31 32 long double 33 scalblnl(long double x, long n) 34 { 35 if (n < INT_MIN) 36 return scalbnl(x, INT_MIN); 37 else if (n > INT_MAX) 38 return scalbnl(x, INT_MAX); 39 else 40 return scalbnl(x, (int)n); 41 } 42 43