Displaying 3 results from an estimated 3 matches for "my_dbl".
2019 Apr 16
2
[FP] Constant folding math library functions
...e,
I noticed today that LLVM's constant folding of math library functions can lead to minor differences in results. A colleague sent me the following test case which demonstrates the issue:
#include <stdio.h>
#include <math.h>
typedef union {
double d;
unsigned long long i;
} my_dbl;
int main(void) {
my_dbl res, x;
x.i = 0x3feeb39556255de2ull;
res.d = tanh(x.d);
printf("tanh(%f) = %f = %016LX\n", x.d, res.d, res.i);
return 0;
}
Compiling with "clang -O2 -g0 -emit-llvm" I get this:
define dso_local i32 @main() local_unnamed_addr #0 {
%1 = tail...
2019 Apr 16
2
[FP] Constant folding math library functions
...ticed today that LLVM's constant folding of math library functions can lead to minor differences in results. A colleague sent me the following test case which demonstrates the issue:
#include <stdio.h>
#include <math.h>
typedef union {
double d;
unsigned long long i;
} my_dbl;
int main(void) {
my_dbl res, x;
x.i = 0x3feeb39556255de2ull;
res.d = tanh(x.d);
printf("tanh(%f) = %f = %016LX\n", x.d, res.d, res.i);
return 0;
}
Compiling with "clang -O2 -g0 -emit-llvm" I get this:
define dso_local i32 @main() local_unnamed_addr #0 {...
2019 Apr 17
3
[FP] Constant folding math library functions
...ryone,
I noticed today that LLVM’s constant folding of math library functions can lead to minor differences in results. A colleague sent me the following test case which demonstrates the issue:
#include <stdio.h>
#include <math.h>
typedef union {
double d;
unsigned long long i;
} my_dbl;
int main(void) {
my_dbl res, x;
x.i = 0x3feeb39556255de2ull;
res.d = tanh(x.d);
printf("tanh(%f) = %f = %016LX\n", x.d, res.d, res.i);
return 0;
}
Compiling with “clang -O2 -g0 -emit-llvm” I get this:
define dso_local i32 @main() local_unnamed_addr #0 {
%1 = tail call doub...