Skip to content

Commit

Permalink
fix bugzilla Issue 24819 - Optimizer changes result of float calculat…
Browse files Browse the repository at this point in the history
…ions on 32-bit (dlang/dmd!17023)

(cherry picked from commit 88d1e8fc37428b873f59d87f8dff1f40fbd3e7a3)
  • Loading branch information
WalterBright authored and dlang-bot committed Oct 24, 2024
1 parent ebafa4e commit d957fbf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/dmd/runnable/test24819.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import core.stdc.stdio;

pragma(inline, true)
double sqrt(double x)
{
static import core.math;
return core.math.sqrt(x);
}

int main()
{
double q = -5.0;
double r = q + 1.0;
double result = sqrt(-r);
//printf("%f\n", result);
assert(result == 2);
return 0;
}

0 comments on commit d957fbf

Please sign in to comment.