I tried to compile x264 out of curiosity and when I finally built it I tried to run the code and got error message from x264 encoder saying that it was miscompiled. After debugging the code I found out what was the source of error and what code was miscompiled.
Basically, log2 and log2f function return wrong results. So, I'm curios if it's a known issue and if there might be some other unpleasant surprises with some other math functions. A simple test to verify wrong results: #include <math.h> #define log2f_correct(x) (logf(x) * 1.44269504088896340736f) for(int lambda=0; lambda<5; ++lambda){ for(int i=2010; i<2020; ++i){ printf ("TEST1: lambda: %d, xxx => %f; log2f(i+1) => %f\n", lambda, lambda * (log2f(i+1)*2 + 0.718f + !!i) + .5f, log2f(i+1)); printf("TEST2: lambda: %d, xxx => %f; log2f_correct (i+1) => %f\n", lambda, lambda * (log2f_correct (i+1)*2 + 0.718f + !!i) + .5f, log2f_correct(i+1)); } } Results are always incorrect, here's a sample output: [INFO ] [-2071554222] 18:28:17: x264: TEST2: lambda: 1, 2013 xxx => 24.168262; log2f_correct (i+1) => 10.975131 [INFO ] [-2071554222] 18:28:17: x264: TEST1: lambda: 1, 2013 xxx => 12.764759; log2f(i+1) => 5.273379 It has to be some sort of loop with expression, otherwise gcc will compute log2f at compile time and will produce correct output (that matches results of log2f_correct) I verified it with both builds of cegcc and had identical errors. ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Cegcc-devel mailing list Cegcc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cegcc-devel