log10 in a 64 bit Intel build on OS X sometimes returns a result of 0, no matter what the argument.
gcc version: Using built-in specs. Target: i686-apple-darwin9 Configured with: /var/tmp/gcc/gcc-5465~16/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/sh are/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-di r=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic --host =i686-apple-darwin9 --target=i686-apple-darwin9 Thread model: posix gcc version 4.0.1 (Apple Inc. build 5465) The program is compiled using g++ -arch x86_64 bug_check.cpp There are no compiler warnings. When run (no arguments on the command line), the first loop produces correct values, but the second produces all 0 results. double broken_log10(double val) { return log10(val); } double working_log10(double val) { double t = log10(val); printf("%g\n", val); return t; } int main(int argc, char **argv) { int n; int len = 10; for (n = 1; n < len; n++) { printf("%d: %g\n", n, working_log10((double)n/(double)len)); } for (n = 1; n < len; n++) { printf("%d: %g\n", n, broken_log10((double)n/(double)len)); } return 0; } -- Summary: problem with log10 and arch x86_64 Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: laura at filmlight dot ltd dot uk GCC build triplet: i686-apple-darwin9 GCC host triplet: i686-apple-darwin9 GCC target triplet: i686-apple-darwin9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35556