Skip to content

Commit

Permalink
add ini_HEX method for ints
Browse files Browse the repository at this point in the history
fixes `%A` formatting (JuliaLang#14409)
  • Loading branch information
simonbyrne authored and pkofod committed Feb 22, 2016
1 parent e907068 commit aaf1235
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions base/printf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,11 @@ function ini_hex(x::Integer)
pt = (len-1)<<2
len,pt,neg
end
function ini_HEX(x::Integer)
len,pt,neg = decode_HEX(x)
pt = (len-1)<<2
len,pt,neg
end

# not implemented
ini_hex(x::Integer,ndigits::Int) = throw(MethodError(ini_hex,(x,ndigits)))
Expand Down
1 change: 1 addition & 0 deletions test/printf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# int
@test (@sprintf "%d" typemax(Int64)) == "9223372036854775807"
@test (@sprintf "%a" typemax(Int64)) == "0x7.fffffffffffffffp+60"
@test (@sprintf "%A" typemax(Int64)) == "0X7.FFFFFFFFFFFFFFFP+60"

for (fmt, val) in (("%i", "42"),
("%u", "42"),
Expand Down

0 comments on commit aaf1235

Please sign in to comment.