fparith_double.c (421B)
1 /* Double-precision fadd/fsub/fmul/fdiv round-trip. 2 * volatile locals defeat constant folding so real FADD/FSUB/FMUL/FDIV (double) 3 * are emitted, plus an FCVTZS for the final (int) conversion. 4 * ((6.0 + 1.0) * 3.0) / 0.5 - 0.0 = 42.0; (int)42.0 == 42. */ 5 int test_main(void) { 6 volatile double a = 6.0, b = 1.0, c = 3.0, d = 0.5; 7 double r = ((a + b) * c) / d; /* (7*3)/0.5 = 42 */ 8 return (int)r == 42 ? 42 : 0; 9 }