Format.jl (based on JuliaIO/Formatting.jl)

https://github.com/JuliaString/Format.jl is now available (although it is unregistered currently).
It is based on https://github.com/JuliaIO/Formatting.jl, however it has dropped v0.4 support, and added support for v0.6-dev.

This (renamed) fork adds the type specific defaults from @tbreloff’s PR:


renames fmt to pyfmt (Python Format) and sprintf1 to cfmt (C format) (fmt is use for type specific output with defaults from Tom’s PR).

I use this package for all the formatted printing support in my package:

Note: I have also submitted a PR https://github.com/JuliaIO/Formatting.jl/pull/30 to make the original Formatting package work on v0.6, if anybody with commit privileges in the JuliaIO org sees this, it’s passing all of the tests and is ready to merge.

How can I submit an issue on your package? Probably cause I was looking at a branch. Posted this issue on Formatting.jl as well. [edited: now closed]
In any case:

julia> s = format(111222333444555666, commas=true, precision = 2 , stripzeros = true )
"111,222,333,444,555,666"

julia> s = format(111222333444555666.01, commas=true, precision = 2 , stripzeros = true )
"111,222,333,444,555,664" # <= shouldn't this be "111,222,333,444,555,666.01"?

That’s not a bug with format, the issue is binary floating point only has 53 bits for the value (really 52, but there’s actually an assumed leading 1 bit for all except subnormal numbers). The rest of the bits are for the sign bit and a biased exponent.

julia> x = 111222333444555666.01
1.1122233344455566e17

julia> nextfloat(x)
1.1122233344455568e17

Yap, sorry for the noise:

julia> 111222333444555666.01 == 111222333444555664
true