| OLD | NEW |
| 1 /* origin: FreeBSD /usr/src/lib/msun/ld80/s_exp2l.c and | 1 /* origin: FreeBSD /usr/src/lib/msun/ld80/s_exp2l.c and |
| 2 * /usr/src/lib/msun/ld128/s_exp2l.c */ | 2 * /usr/src/lib/msun/ld128/s_exp2l.c */ |
| 3 /*- | 3 /*- |
| 4 * Copyright (c) 2005-2008 David Schultz <das@FreeBSD.ORG> | 4 * Copyright (c) 2005-2008 David Schultz <das@FreeBSD.ORG> |
| 5 * All rights reserved. | 5 * All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 * a degree-10 minimax polynomial with maximum error under 2**-120. | 516 * a degree-10 minimax polynomial with maximum error under 2**-120. |
| 517 * The values in exp2t[] and eps[] are chosen such that | 517 * The values in exp2t[] and eps[] are chosen such that |
| 518 * exp2t[i] = exp2(i/TBLSIZE + eps[i]), and eps[i] is a small offset such | 518 * exp2t[i] = exp2(i/TBLSIZE + eps[i]), and eps[i] is a small offset such |
| 519 * that exp2t[i] is accurate to 2**-122. | 519 * that exp2t[i] is accurate to 2**-122. |
| 520 * | 520 * |
| 521 * Note that the range of i is +-TBLSIZE/2, so we actually index the tables | 521 * Note that the range of i is +-TBLSIZE/2, so we actually index the tables |
| 522 * by i0 = i + TBLSIZE/2. | 522 * by i0 = i + TBLSIZE/2. |
| 523 * | 523 * |
| 524 * This method is due to Gal, with many details due to Gal and Bachelis: | 524 * This method is due to Gal, with many details due to Gal and Bachelis: |
| 525 * | 525 * |
| 526 *» Gal, S. and Bachelis, B. An Accurate Elementary Mathematical Library | 526 * Gal, S. and Bachelis, B. An Accurate Elementary Mathematical Library |
| 527 *» for the IEEE Floating Point Standard. TOMS 17(1), 26-46 (1991). | 527 * for the IEEE Floating Point Standard. TOMS 17(1), 26-46 (1991). |
| 528 */ | 528 */ |
| 529 long double exp2l(long double x) { | 529 long double exp2l(long double x) { |
| 530 union ldshape u = {x}; | 530 union ldshape u = {x}; |
| 531 int e = u.i.se & 0x7fff; | 531 int e = u.i.se & 0x7fff; |
| 532 long double r, z, t; | 532 long double r, z, t; |
| 533 uint32_t i0; | 533 uint32_t i0; |
| 534 union { | 534 union { |
| 535 uint32_t u; | 535 uint32_t u; |
| 536 int32_t i; | 536 int32_t i; |
| 537 } k; | 537 } k; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 z * (P3 + | 583 z * (P3 + |
| 584 z * (P4 + | 584 z * (P4 + |
| 585 z * (P5 + | 585 z * (P5 + |
| 586 z * (P6 + | 586 z * (P6 + |
| 587 z * (P7 + | 587 z * (P7 + |
| 588 z * (P8 + z * (P9 + z * P10))))))))); | 588 z * (P8 + z * (P9 + z * P10))))))))); |
| 589 | 589 |
| 590 return scalbnl(r, k.i); | 590 return scalbnl(r, k.i); |
| 591 } | 591 } |
| 592 #endif | 592 #endif |
| OLD | NEW |