Ignore:
Timestamp:
Oct 11, 2010, 3:05:24 PM (11 years ago)
Author:
charles
Message:

(trunk libT) #3521 "rounding issue in tr_truncd()" -- fixed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.c

    r11252 r11298  
    2525#include <ctype.h> /* isalpha(), tolower() */
    2626#include <errno.h>
    27 #include <math.h> /* pow(), fabs() */
     27#include <math.h> /* pow(), fabs(), floor() */
    2828#include <stdarg.h>
    2929#include <stdio.h>
     
    13871387{
    13881388    const int i = (int) pow( 10, decimal_places );
    1389     const double xup = x * i;
    1390     const double x2 = (int64_t)(xup);
    1391     return x2 / i;
     1389    return floor( x * i ) / i;
    13921390}
    13931391
Note: See TracChangeset for help on using the changeset viewer.