Hi, On 2024-01-05 13:47:25 +0100, Aurélie Tisson (BastaPrint) wrote: > The same calculation gives me 2 different values : 0.993013 0.860892 > wheras it should give 0.993013 only (tells GCC).
Well, your code is not portable. > #include <stdio.h> > #include <math.h> > int main(){ > double s = .7; > double a = (1. - .1 * s) / (1. + .1 * s); ^^^^^^^^^^^ ^^^^^^^^^^^ > double b = pow(a, .05); > double c = pow( ((1. - .1 * s) / (1. + .1 * s)), .05); ^^^^^^^^^^^ ^^^^^^^^^^^ > printf("%f %f \n", b, c); > } You should not depend on contraction of FP expressions. Here, GCC may generate a FMA, which generally increases the accuracy of the results. -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel