https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66346
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Ruslan from comment #0) > #include <cmath> > int main() > { > volatile long double two=2.L; > long double vol=log10(two); > long double con=log10(2.L); These do not calculate the result as long double, you are calling ::log10 from the C library, which takes a double not a long double. If you call log10l or std::log10 then you get the long double overload, and should get: computed constant: 0.3010299956639811952 computed volatile: 0.3010299956639811952 reference value : 0.3010299956639811952 Also, note that including <cmath> then calling log10 unqualified is not portable, if you want to call it unqualified you need to include <math.h>, or if you include <cmath> you should be calling std::log10.