]>
Commit | Line | Data |
---|---|---|
e3232933 RS |
1 | /* Copyright (C) 2003 Free Software Foundation. |
2 | ||
3 | Check that constant folding of mathematical expressions doesn't | |
4 | break anything. | |
5 | ||
6 | Written by Roger Sayle, 24th August 2003. */ | |
7 | ||
8 | /* { dg-do run } */ | |
9 | /* { dg-options "-O2 -ffast-math" } */ | |
10 | ||
11 | void abort(void); | |
12 | ||
13 | double foo(double x) | |
14 | { | |
15 | return 12.0/(x*3.0); | |
16 | } | |
17 | ||
18 | double bar(double x) | |
19 | { | |
20 | return (3.0/x)*4.0; | |
21 | } | |
22 | ||
23 | int main() | |
24 | { | |
25 | if (foo(2.0) != 2.0) | |
26 | abort (); | |
27 | ||
28 | if (bar(2.0) != 6.0) | |
29 | abort (); | |
30 | ||
31 | return 0; | |
32 | } | |
33 |