digitalmars.D.bugs - [Issue 17437] New: Incorrect range check when implicitly converting
- via Digitalmars-d-bugs (22/22) May 25 2017 https://issues.dlang.org/show_bug.cgi?id=17437
https://issues.dlang.org/show_bug.cgi?id=17437 Issue ID: 17437 Summary: Incorrect range check when implicitly converting integer literals to float/double Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: kinke gmx.net The integer value is cast to float/double, and that value is then compared for equality against the original integer value. The comparison is thus performed incorrectly as floating-point type with a potentially smaller integer range. `long.max` (2^63-1) cannot be represented as double, it's rounded up to 2^63, but a `double f = 0x1.0p+63` equals a `long i = long.max` as the comparison is performed as double (and thus `i` rounded up too). See https://github.com/dlang/dmd/pull/6831. --
May 25 2017