Changeset 2322


Ignore:
Timestamp:
Feb 2, 2013, 7:28:31 PM (7 years ago)
Author:
sam
Message:

math: fix a signed integer overflow issue in the fast factorial
computation function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/math/real.cpp

    r2317 r2322  
    764764}
    765765
    766 static real fast_fact(int x)
     766static real fast_fact(unsigned int x)
    767767{
    768768    real ret = real::R_1();
    769     int i = 1, multiplier = 1, exponent = 0;
     769    unsigned int i = 1, multiplier = 1, exponent = 0;
    770770
    771771    for (;;)
     
    775775            return ldexp(ret * multiplier, exponent);
    776776
    777         int tmp = i;
     777        unsigned int tmp = i;
    778778        while ((tmp & 1) == 0)
    779779        {
Note: See TracChangeset for help on using the changeset viewer.