k_expf.c (226597) | k_expf.c (230371) |
---|---|
1/*- 2 * Copyright (c) 2011 David Schultz <das@FreeBSD.ORG> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2011 David Schultz <das@FreeBSD.ORG> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/lib/msun/src/k_expf.c 226597 2011-10-21 06:27:56Z das $"); | 28__FBSDID("$FreeBSD: head/lib/msun/src/k_expf.c 230371 2012-01-20 07:02:42Z das $"); |
29 30#include <complex.h> 31 32#include "math.h" 33#include "math_private.h" 34 35static const uint32_t k = 235; /* constant for reduction */ 36static const float kln2 = 162.88958740F; /* k * ln2 */ 37 38/* 39 * See k_exp.c for details. 40 * 41 * Input: ln(FLT_MAX) <= x < ln(2 * FLT_MAX / FLT_MIN_DENORM) ~= 192.7 42 * Output: 2**127 <= y < 2**128 43 */ 44static float 45__frexp_expf(float x, int *expt) 46{ | 29 30#include <complex.h> 31 32#include "math.h" 33#include "math_private.h" 34 35static const uint32_t k = 235; /* constant for reduction */ 36static const float kln2 = 162.88958740F; /* k * ln2 */ 37 38/* 39 * See k_exp.c for details. 40 * 41 * Input: ln(FLT_MAX) <= x < ln(2 * FLT_MAX / FLT_MIN_DENORM) ~= 192.7 42 * Output: 2**127 <= y < 2**128 43 */ 44static float 45__frexp_expf(float x, int *expt) 46{ |
47 double exp_x; | 47 float exp_x; |
48 uint32_t hx; 49 50 exp_x = expf(x - kln2); 51 GET_FLOAT_WORD(hx, exp_x); 52 *expt = (hx >> 23) - (0x7f + 127) + k; 53 SET_FLOAT_WORD(exp_x, (hx & 0x7fffff) | ((0x7f + 127) << 23)); 54 return (exp_x); 55} --- 32 unchanged lines hidden --- | 48 uint32_t hx; 49 50 exp_x = expf(x - kln2); 51 GET_FLOAT_WORD(hx, exp_x); 52 *expt = (hx >> 23) - (0x7f + 127) + k; 53 SET_FLOAT_WORD(exp_x, (hx & 0x7fffff) | ((0x7f + 127) << 23)); 54 return (exp_x); 55} --- 32 unchanged lines hidden --- |