[Issue 13743] New: floating point inconsistent division by zero

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Nov 17 03:15:57 PST 2014


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

          Issue ID: 13743
           Summary: floating point inconsistent division by zero
           Product: D
           Version: D1 & D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: public at dicebot.lv

```
void main()
{
    real x = 1;
    real y = x / 0;
    assert(y is real.infinity);    
}
```

This passes when compiled without optimizations and fails when compiled with
-O. When optimizations are enabled y is evaluated as NaN (probaby because of
const-folding?)

I don't know if this is bug or feature and if it should be fixed / changed at
all but creating bugzilla issue just so that it won't be as much of surprise to
others :)

--


More information about the Digitalmars-d-bugs mailing list