JuliaMath / FixedPointNumbers.jl

fixed point types for julia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[RFC] Suffix in `print(::IO, ::FixedPoint)` or `string(::FixedPoint)`

kimikage opened this issue · comments

Currently, print() and string() for FixedPoint numbers output a suffixed string.

julia> print(stdout, 0.5N0f8);
0.502N0f8

julia> string(0.5N0f8)
"0.502N0f8"

print falls back to calling show, so most types should just define show. Define print if your type has a separate "plain" representation.

https://docs.julialang.org/en/v1.5.3/base/io-network/#Base.print

I think the representation without the suffix is "plain", just like the case of Float32.

julia> show(stdout, 0.5f0);
0.5f0
julia> print(stdout, 0.5f0);
0.5