Changeset 9177


Ignore:
Timestamp:
Sep 26, 2009, 4:24:45 AM (12 years ago)
Author:
charles
Message:

(trunk, libT) #2379: infinite ratio shows as nan, invalid json

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.c

    r8904 r9177  
    13291329tr_truncd( double x, int decimal_places )
    13301330{
    1331     const int i = (int) pow( 10, decimal_places );
    1332     double x2 = (int)(x*i);
     1331    static const int multiplier[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000 };
     1332    const int64_t i = multiplier[decimal_places];
     1333    double x2 = (int64_t)(x*i);
    13331334    return x2 / i;
    13341335}
Note: See TracChangeset for help on using the changeset viewer.