Skip to content

Commit d957fbf

Browse files
WalterBrightdlang-bot
authored andcommitted
fix bugzilla Issue 24819 - Optimizer changes result of float calculations on 32-bit (dlang/dmd!17023)
(cherry picked from commit 88d1e8fc37428b873f59d87f8dff1f40fbd3e7a3)
1 parent ebafa4e commit d957fbf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/dmd/runnable/test24819.d

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import core.stdc.stdio;
2+
3+
pragma(inline, true)
4+
double sqrt(double x)
5+
{
6+
static import core.math;
7+
return core.math.sqrt(x);
8+
}
9+
10+
int main()
11+
{
12+
double q = -5.0;
13+
double r = q + 1.0;
14+
double result = sqrt(-r);
15+
//printf("%f\n", result);
16+
assert(result == 2);
17+
return 0;
18+
}

0 commit comments

Comments
 (0)