Changeset 1021


Ignore:
Timestamp:
Oct 13, 2011, 1:31:11 AM (8 years ago)
Author:
sam
Message:

core: fix a bug in real::log() and real::log2() with values smaller than 1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/real.cpp

    r1020 r1021  
    643643    }
    644644    tmp.m_signexp = (1 << 30) - 1;
    645     return (real)(x.m_signexp - (1 << 30) + 1) * real::R_LN2 + fast_log(tmp);
     645    return (real)(int)(x.m_signexp - (1 << 30) + 1) * real::R_LN2
     646           + fast_log(tmp);
    646647}
    647648
     
    657658    }
    658659    tmp.m_signexp = (1 << 30) - 1;
    659     return (real)(x.m_signexp - (1 << 30) + 1) + fast_log(tmp) * real::R_LOG2E;
     660    return (real)(int)(x.m_signexp - (1 << 30) + 1)
     661           + fast_log(tmp) * real::R_LOG2E;
    660662}
    661663
Note: See TracChangeset for help on using the changeset viewer.