www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23284] New: Enhance floating point not representable error

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 puremagic.com
          Reporter: alphaglosined 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`.
```

--
Aug 06 2022