Skip to content

Commit

Permalink
Merge pull request #7155 from n8sh/issue-20159-followup
Browse files Browse the repository at this point in the history
Issue 20159 Followup - fix ldc-win32 test failure
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
  • Loading branch information
dlang-bot authored Aug 24, 2019
2 parents 5c9ccfc + ef29e25 commit f7fc24c
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions std/math.d
Original file line number Diff line number Diff line change
Expand Up @@ -4501,16 +4501,15 @@ real scalbn(real x, int n) @trusted nothrow @nogc
{
if (__ctfe)
{
version (FreeBSD)
{
// Other path overflows on FreeBSD even though it shouldn't.
if (n > 999)
return scalbn(x * 0x1.0p999L, n - 999);
if (n < -999)
return scalbn(x * 0x1.0p-999L, n + 999);
}
if (n >= real.max_exp || n <= real.min_exp) // When 2.0L ^^ n is not representable.
return (x * (2.0L ^^ (n / 2))) * (2.0L ^^ (n - (n / 2)));
//if (n >= real.max_exp || n <= real.min_exp) // When 2.0L ^^ n is not representable.
// return (x * (2.0L ^^ (n / 2))) * (2.0L ^^ (n - (n / 2)));
// We'd rather use the above code but it doesn't work on all compiler +
// architecture + OS combinations. The issue might be that 80 bit reals
// are advertised to exist but CTFE reals are 64 bit.
if (n > 999)
return scalbn(x * 0x1.0p999L, n - 999);
else if (n < -999)
return scalbn(x * 0x1.0p-999L, n + 999);
else
return x * (2.0L ^^ n);
}
Expand Down

0 comments on commit f7fc24c

Please sign in to comment.