https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66346
Bug ID: 66346 Summary: GCC computes log10(2.L) constant wrongly Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: b7.10110111 at gmail dot com Target Milestone: --- Consider the following code: #include <iostream> #include <cmath> int main() { volatile long double two=2.L; long double vol=log10(two); long double con=log10(2.L); long double ref=0.3010299956639811952L; std::cout.precision(19); std::cout << "computed constant: " << con << '\n'; std::cout << "computed volatile: " << vol << '\n'; std::cout << "reference value : " << ref << "\n"; } Here reference value was computed using Wolfram Mathematica via N[Log10[2],19] command. On x86 system it this code, compiled with gcc 4.5, 4.8, 4.9 and 5.1, gives me this output: computed constant: 0.301029995663981198 computed volatile: 0.3010299956639811952 reference value : 0.3010299956639811952 On x86_64 system it prints this: computed constant: 0.301029995663981198 computed volatile: 0.301029995663981198 reference value : 0.3010299956639811952 This appears to be wrong result. The same code compiled by clang++ 3.0.6ubuntu3 gives all values equal to reference value.