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 #6608, fix #9072)
  • Loading branch information
vtjnash committed Apr 17, 2015
1 parent 0049487 commit 1890e57
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

2 comments on commit 1890e57

@tkelman
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this breaks the tests

@vtjnash
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-patched in c40bbc6

Please sign in to comment.