e_log.c (251024) | e_log.c (251292) |
---|---|
1 2/* @(#)e_log.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 <sys/cdefs.h> | 1 2/* @(#)e_log.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 <sys/cdefs.h> |
15__FBSDID("$FreeBSD: head/lib/msun/src/e_log.c 251024 2013-05-27 08:50:10Z das $"); | 15__FBSDID("$FreeBSD: head/lib/msun/src/e_log.c 251292 2013-06-03 09:14:31Z das $"); |
16 17/* __ieee754_log(x) 18 * Return the logrithm of x 19 * 20 * Method : 21 * 1. Argument Reduction: find k and f such that 22 * x = 2^k * (1+f), 23 * where sqrt(2)/2 < 1+f < sqrt(2) . --- 36 unchanged lines hidden (view full) --- 60 * 61 * Constants: 62 * The hexadecimal values are the intended ones for the following 63 * constants. The decimal values may be used, provided that the 64 * compiler will convert from decimal to binary accurately enough 65 * to produce the hexadecimal values shown. 66 */ 67 | 16 17/* __ieee754_log(x) 18 * Return the logrithm of x 19 * 20 * Method : 21 * 1. Argument Reduction: find k and f such that 22 * x = 2^k * (1+f), 23 * where sqrt(2)/2 < 1+f < sqrt(2) . --- 36 unchanged lines hidden (view full) --- 60 * 61 * Constants: 62 * The hexadecimal values are the intended ones for the following 63 * constants. The decimal values may be used, provided that the 64 * compiler will convert from decimal to binary accurately enough 65 * to produce the hexadecimal values shown. 66 */ 67 |
68#include <float.h> 69 |
|
68#include "math.h" 69#include "math_private.h" 70 71static const double 72ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ 73ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ 74two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ 75Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ --- 58 unchanged lines hidden (view full) --- 134 hfsq=0.5*f*f; 135 if(k==0) return f-(hfsq-s*(hfsq+R)); else 136 return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); 137 } else { 138 if(k==0) return f-s*(f-R); else 139 return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); 140 } 141} | 70#include "math.h" 71#include "math_private.h" 72 73static const double 74ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ 75ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ 76two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ 77Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ --- 58 unchanged lines hidden (view full) --- 136 hfsq=0.5*f*f; 137 if(k==0) return f-(hfsq-s*(hfsq+R)); else 138 return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); 139 } else { 140 if(k==0) return f-s*(f-R); else 141 return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); 142 } 143} |
144 145#if (LDBL_MANT_DIG == 53) 146__weak_reference(log, logl); 147#endif |
|