Changeset 1017 for trunk/src/real.cpp
- Timestamp:
- Oct 12, 2011, 12:01:44 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/real.cpp
r1016 r1017 23 23 { 24 24 25 static int const BIGIT_BITS = 32;26 27 25 real::real(float f) { *this = (double)f; } 28 26 real::real(int i) { *this = (double)i; } … … 501 499 ret.m_signexp |= (exponent - 1) & 0x7fffffffu; 502 500 503 /* FIXME: log2(BIGITS) steps of Newton-Raphson seems to be enough for501 /* FIXME: 1+log2(BIGITS) steps of Newton-Raphson seems to be enough for 504 502 * convergence, but this hasn't been checked seriously. */ 505 for (int i = 2; i <real::BIGITS; i *= 2)503 for (int i = 1; i <= real::BIGITS; i *= 2) 506 504 ret = ret * (real::R_2 - ret * x); 507 505 … … 545 543 ret.m_signexp |= exponent & 0x7fffffffu; 546 544 547 /* FIXME: log2(BIGITS) steps of Newton-Raphson seems to be enough for545 /* FIXME: 1+log2(BIGITS) steps of Newton-Raphson seems to be enough for 548 546 * convergence, but this hasn't been checked seriously. */ 549 for (int i = 2; i <real::BIGITS; i *= 2)547 for (int i = 1; i <= real::BIGITS; i *= 2) 550 548 { 551 549 ret = ret * (real::R_3 - ret * ret * x); … … 669 667 if (exponent <= 0) 670 668 ret.m_mantissa[i] = 0; 671 else if (exponent < BIGIT_BITS)672 ret.m_mantissa[i] &= ~((1 << ( BIGIT_BITS - exponent)) - 1);673 674 exponent -= BIGIT_BITS;669 else if (exponent < real::BIGIT_BITS) 670 ret.m_mantissa[i] &= ~((1 << (real::BIGIT_BITS - exponent)) - 1); 671 672 exponent -= real::BIGIT_BITS; 675 673 } 676 674
Note: See TracChangeset
for help on using the changeset viewer.