for floats fabs is better & smaller then ABS
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 20 Jul 2006 09:06:23 +0000 (09:06 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 20 Jul 2006 09:06:23 +0000 (09:06 +0000)
Originally committed as revision 5801 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavutil/rational.c

index b4700c7..df4b218 100644 (file)
@@ -102,7 +102,7 @@ AVRational av_sub_q(AVRational b, AVRational c){
  */
 AVRational av_d2q(double d, int max){
     AVRational a;
-    int exponent= FFMAX( (int)(log(ABS(d) + 1e-20)/log(2)), 0);
+    int exponent= FFMAX( (int)(log(fabs(d) + 1e-20)/log(2)), 0);
     int64_t den= 1LL << (61 - exponent);
     av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max);