Skip to content

Commit

Permalink
grisu: don't print trailing zeros on numbers after having potentially…
Browse files Browse the repository at this point in the history
… rounded them, use scientific notation instead (fix JuliaLang#6608, fix JuliaLang#9072)
  • Loading branch information
vtjnash authored and mbauman committed Jun 5, 2015
1 parent d6b0b06 commit 76bac45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/grisu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function _show(io::IO, x::FloatingPoint, mode, n::Int, typed, nanstr, infstr)
end
end
neg && write(io,'-')
if pt <= -4 || pt > 6 # .00001 to 100000.
if pt <= -4 || pt > 6 || pt >= n # .00001 to 100000.
# => #.#######e###
write(io, pdigits, 1)
write(io, '.')
Expand Down

0 comments on commit 76bac45

Please sign in to comment.