Error while formatting a specific number!

There seem to be some longstanding bugs in the floating-point formatting provided by the Formatting.jl package (e.g. printfmt("1:.4e, 40000.0) prints 3.10000e+04 · Issue #71 · JuliaIO/Formatting.jl · GitHub).

I would tend to recommend using Julia’s Printf standard library instead:

julia> using Printf

julia> @sprintf("%0.4E", 3.0e-8)
"3.0000E-08"

PS. Please quote your code.

2 Likes