s_expm1.c (226380) | s_expm1.c (226596) |
---|---|
1/* @(#)s_expm1.c 5.1 93/09/24 */ 2/* 3 * ==================================================== 4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Developed at SunPro, a Sun Microsystems, Inc. business. 7 * Permission to use, copy, modify, and distribute this 8 * software is freely granted, provided that this notice 9 * is preserved. 10 * ==================================================== 11 */ 12 13#include <sys/cdefs.h> | 1/* @(#)s_expm1.c 5.1 93/09/24 */ 2/* 3 * ==================================================== 4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Developed at SunPro, a Sun Microsystems, Inc. business. 7 * Permission to use, copy, modify, and distribute this 8 * software is freely granted, provided that this notice 9 * is preserved. 10 * ==================================================== 11 */ 12 13#include <sys/cdefs.h> |
14__FBSDID("$FreeBSD: head/lib/msun/src/s_expm1.c 226380 2011-10-15 07:00:28Z das $"); | 14__FBSDID("$FreeBSD: head/lib/msun/src/s_expm1.c 226596 2011-10-21 06:26:38Z das $"); |
15 16/* expm1(x) 17 * Returns exp(x)-1, the exponential of x minus 1. 18 * 19 * Method 20 * 1. Argument reduction: 21 * Given x, find r and integer k such that 22 * --- 80 unchanged lines hidden (view full) --- 103 * 104 * Constants: 105 * The hexadecimal values are the intended ones for the following 106 * constants. The decimal values may be used, provided that the 107 * compiler will convert from decimal to binary accurately enough 108 * to produce the hexadecimal values shown. 109 */ 110 | 15 16/* expm1(x) 17 * Returns exp(x)-1, the exponential of x minus 1. 18 * 19 * Method 20 * 1. Argument reduction: 21 * Given x, find r and integer k such that 22 * --- 80 unchanged lines hidden (view full) --- 103 * 104 * Constants: 105 * The hexadecimal values are the intended ones for the following 106 * constants. The decimal values may be used, provided that the 107 * compiler will convert from decimal to binary accurately enough 108 * to produce the hexadecimal values shown. 109 */ 110 |
111#include <float.h> 112 |
|
111#include "math.h" 112#include "math_private.h" 113 114static const double 115one = 1.0, 116huge = 1.0e+300, 117tiny = 1.0e-300, 118o_threshold = 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */ --- 44 unchanged lines hidden (view full) --- 163 else 164 {hi = x + ln2_hi; lo = -ln2_lo; k = -1;} 165 } else { 166 k = invln2*x+((xsb==0)?0.5:-0.5); 167 t = k; 168 hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ 169 lo = t*ln2_lo; 170 } | 113#include "math.h" 114#include "math_private.h" 115 116static const double 117one = 1.0, 118huge = 1.0e+300, 119tiny = 1.0e-300, 120o_threshold = 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */ --- 44 unchanged lines hidden (view full) --- 165 else 166 {hi = x + ln2_hi; lo = -ln2_lo; k = -1;} 167 } else { 168 k = invln2*x+((xsb==0)?0.5:-0.5); 169 t = k; 170 hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ 171 lo = t*ln2_lo; 172 } |
171 x = hi - lo; | 173 STRICT_ASSIGN(double, x, hi - lo); |
172 c = (hi-x)-lo; 173 } 174 else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */ 175 t = huge+x; /* return x with inexact flags when x!=0 */ 176 return x - (t-(huge+x)); 177 } 178 else k = 0; 179 --- 36 unchanged lines hidden --- | 174 c = (hi-x)-lo; 175 } 176 else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */ 177 t = huge+x; /* return x with inexact flags when x!=0 */ 178 return x - (t-(huge+x)); 179 } 180 else k = 0; 181 --- 36 unchanged lines hidden --- |