JuliaMath / JuliaMath/Quadmath.jl
`repr(::Float128)` is broken
- Dominant language
- Julia
- Stars
- 44
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
In Julia, `repr(x)` is supposed to return valid Julia code that can be executed to reconstruct an object equivalent to `x`. For example, `repr(::Float16)` and `repr(::Float32)` add annotations to `x` indicating its type:
```
julia> repr(Float16(1))
"Float16(1.0)"
julia> repr(Float32(1))
"1.0f0"
```
However, `repr(::Float128)` fails to do this, and evaluating its result yields a `Float64`.
```
julia> repr(Float128(1))
"1.00000000000000000000000000000000000e+00"
julia> 1.00000000000000000000000000000000000e+00 |> typeof
Float64
```
In particular, `repr(::Float128)` is completely broken for `Inf128` and `NaN128`, which are currently formatted as `inf` and `nan`.
```
julia> repr(Float128(Inf))
"inf"
julia> repr(Float128(NaN))
"nan"
julia> inf
ERROR: UndefVarError: `inf` not defined
julia> nan
ERROR: UndefVarError: `nan` not defined
```
These should format as `Inf128` and `NaN128` (see #83) respectively.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.