Hello,
This is a small change, which can be summarized as follows:
- allow floating point numbers to be written using hex digits.
The format is exactly the same as decimal floating point numbers, except for:
- the literals start with 0x
- the digits are in hex
- the exponent symbol is `p` or `P`, instead of `e` or `E`
- the exponent is in base 2, rather than base 10
This notation has become popular among people working with floating point numbers, as the numbers you write can be represented exactly, which is not the case for base 10 numbers.
The following points were discussed:
- the exact format to use, compared to what's allowed by other languages: we decided to just follow Haskell's decimal float notation, for least surprise
- should overflow (which becomes `Inf`) result in a warning? We decided that this is an orthogonal issue, also relevant to decimal floating point and made a GHC ticket (#13232)
- there is an odd interaction between floating point (both decimal and hex) and -XNegativeLiterals, related to negative 0, see ticket #13211
- changing the Read instances for Float and Double to recognize hex floats could break some programs, although that does not seem all that likely
- there is a question of how many extra pretty printing functions to add to `Numeric`: the current thinking is that maybe just one `showHFloat` is sufficient; the alternative is to add 5, mirroring the `show[E,F,G]Float` functions for decimals.
I haven't done the changes to the libraries yet.
Please let me know if you have any objections or suggestions on what might needs to be changed.
Cheers,
-Iavor