[Issue 20951] Wrong Decimal Literals Encoding

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 19 02:26:30 UTC 2020


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

--- Comment #3 from Илья Ярошенко <ilyayaroshenko at gmail.com> ---
In C:

```
static double d = 2075e23;
```

is encoded as


```
.LCPI0_0:
        .quad   5000531031573652307     # double 2.0749999999999998E+26

```

and


```
static double d = 2075e23L; // with L at the end
```

is encoded as


```
.LCPI0_0:
        .quad   5000531031573652308     # double 2.0750000000000002E+26

```

as expected.


In D we always have the last case which makes D a non-IEEE language, as well as
non-C compatible. `toPrec` can't solve this issue.

--


More information about the Digitalmars-d-bugs mailing list