[LLVMdev] pow operator on Windows
Michael Smith
Michael.Smith at synopsys.com
Fri Feb 11 20:52:27 PST 2011
I have a very simple test case on Windows that shows some surprising behavior. This doesn't seem to be a problem on Linux.
The example is:
#include <stdio.h>
#include <math.h>
double heat(double Pr) {
return pow(Pr, 0.33);
}
int main(int argc, char **argv) {
double Nu = heat(291.00606180486119);
printf("%.20f\n", Nu);
}
I've tested with MinGW's gcc.exe 3.4.5 and the Visual Studio 2008 C++ compiler, and LLVM 2.7 and 2.8.
With "gcc test.c; ./a.exe", the printed result is 6.50260946378542390000
With "clang -emit-llvm -c test.c -o test.bc; lli test.bc", the printed result is 6.50260946378542480000
The difference in the last 2 digits is significant in the scientific software I'm working on. Does anyone have an explanation for why they differ, or how to make them behave the same?
Thanks,
Michael Smith
More information about the llvm-dev
mailing list