Skip to content

Commit

Permalink
Document rounding away from zero (JuliaLang#20775)
Browse files Browse the repository at this point in the history
  • Loading branch information
TotalVerb authored and StefanKarpinski committed Feb 24, 2017
1 parent b0ca50b commit 078835c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion base/printf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,9 @@ end
Print `args` using C `printf()` style format specification string, with some caveats:
`Inf` and `NaN` are printed consistently as `Inf` and `NaN` for flags `%a`, `%A`,
`%e`, `%E`, `%f`, `%F`, `%g`, and `%G`.
`%e`, `%E`, `%f`, `%F`, `%g`, and `%G`. Furthermore, if a floating point number is
equally close to the numeric values of two possible output strings, the output
string further away from zero is chosen.
Optionally, an `IOStream`
may be passed as the first argument to redirect output.
Expand All @@ -1206,6 +1208,9 @@ may be passed as the first argument to redirect output.
```jldoctest
julia> @printf("%f %F %f %F\\n", Inf, Inf, NaN, NaN)
Inf Inf NaN NaN\n
julia> @printf "%.0f %.1f %f\\n" 0.5 0.025 -0.0078125
1 0.0 -0.007813
```
"""
macro printf(args...)
Expand Down

0 comments on commit 078835c

Please sign in to comment.