[Ffmpeg-cvslog] r8474 - trunk/libavcodec/resample2.c

Uoti Urpala uoti.urpala
Thu Mar 22 17:39:16 CET 2007


On Thu, 2007-03-22 at 17:20 +0100, Michael Niedermayer wrote:
> On Thu, Mar 22, 2007 at 10:18:04AM -0500, Rich Felker wrote:
> > Associative law is false with floats. Think of
> > 
> > A = FLOAT_MAX
> > B = FLOAT_MAX
> > C = 1.0/FLOAT_MAX
> 
> yes i did think of it, and i just tested:
> ------
> #include <float.h>
> #include <stdio.h>
> 
> float a= FLT_MAX;
> float b= FLT_MAX;
> float c= 1.0/FLT_MAX;
> 
> main(){
>     printf("%f %f\n", (a*b)*c, a*(b*c));
> }
> ------
> output is:
> 340282326356120465085853374166440345600.000000 340282326356120465085853374166440345600.000000
> even with gcc -O0

That's because you used floats but gcc kept the variables in FPU
registers. Try it with long doubles or use -ffloat-store.





More information about the ffmpeg-cvslog mailing list