diff --git a/libtransmission/utils.c b/libtransmission/utils.c index c76d99881..13c5f45bb 100644 --- a/libtransmission/utils.c +++ b/libtransmission/utils.c @@ -24,7 +24,7 @@ #include #include /* isalpha(), tolower() */ #include -#include /* pow(), fabs() */ +#include /* pow(), fabs(), floor() */ #include #include #include @@ -1386,9 +1386,7 @@ double tr_truncd( double x, int decimal_places ) { const int i = (int) pow( 10, decimal_places ); - const double xup = x * i; - const double x2 = (int64_t)(xup); - return x2 / i; + return floor( x * i ) / i; } char*