www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21581] New: -inline discards floating point precision of

https://issues.dlang.org/show_bug.cgi?id=21581

          Issue ID: 21581
           Summary: -inline discards floating point precision of return
                    values
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Related to issue 21376, the following test fails when compiled with `-inline`.

---
import core.math;

float hypot(float x, float y)
{
    float u = fabs(x);
    float v = fabs(y);
    return sqrt(u*u + v*v);
}

float abs(float re, float im)
{
    return hypot(re, im);
}

void log(real x)
{
    assert(x == 1);
}

extern(C) void main()
{
    float re = 0.866025403784438646787;
    float im = 0.5;
    return log(abs(re, im));
}
---

This only occurs with dmd (gdc and ldc do not have this issue).

--
Jan 25