[Issue 23284] New: Enhance floating point not representable error message

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 6 22:55:49 UTC 2022


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

          Issue ID: 23284
           Summary: Enhance floating point not representable error message
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: alphaglosined at gmail.com

If a floating point number is not representable in the given type (float/real)
but it is using a higher precision (real/double), the error message should
include the suggestion to change types and use the L suffix.

Currently:

```d
real x = 0x1p-16383; // Error: number `0x1p-16383` is not representable
```

Example output:

```d
real x = 0x1p-16383; // Error: number `0x1p-16383` is not representable using
`real` but can be represented by a `double` by adding the suffix `L`.
```

--


More information about the Digitalmars-d-bugs mailing list