DecFP.jl icon indicating copy to clipboard operation
DecFP.jl copied to clipboard

printf is converting to `Float64`

Open stevengj opened this issue 2 years ago • 1 comments

It looks like the @printf macro is broken — it seems to be converting values to Float64 before printing (reported on discourse):

julia> using DecFP, Printf

julia> x = rand(Dec128)
0.6498353664629435612857337361220566

julia> println(x)
0.6498353664629435612857337361220566

julia> @printf("%.36f", x)
0.649835366462943597731793943239608780
julia> 

julia> @printf("%.36f\n", Float64(x)) # matches @printf("%.36f", x) !!
0.649835366462943597731793943239608780

@jmkuhn, has @printf bitrotted? I thought it used to be working (after #48).

stevengj avatar Jan 20 '24 01:01 stevengj

Yes, this worked correctly through Julia 1.5.x. It broke in Julia 1.6.0 with https://github.com/JuliaLang/julia/pull/32859.

jmkuhn avatar Feb 22 '24 20:02 jmkuhn