Skip to content

Commit 31d7210

Browse files
authored
Rewrite printf functionality (#32859)
* Rewrite Printf module * Fix whitespace * Rebase fixups * Fix docs * Fix tests * Fix last test * Add back in new tests from 521813b * Fix merge conflict * Remove Printf from tests * Some code cleanup; use at-ccall, add some code comments, docstring for Printf.Format, bump up unrolling from 8 -> 16, remove unnecessary exports * Fix failing docs * Fix 32-bit * Fix some commented out tests * Remove debug file * Fix octal tests * Add NEWS, docstring for Printf.format, and remove extra file
1 parent bb5a09f commit 31d7210

File tree

11 files changed

+1315
-2910
lines changed

11 files changed

+1315
-2910
lines changed

NEWS.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ Build system changes
5555
`./julia-installer.exe /TASKS="desktopicon,startmenu,addtopath"`, adds a desktop
5656
icon, a startmenu group icon, and adds Julia to system PATH.
5757

58+
59+
Library functions
60+
-----------------
61+
* The `Base.Grisu` code has been officially removed (float printing was switched to the ryu algorithm code in 1.4)
62+
63+
5864
New library functions
5965
---------------------
6066

@@ -100,6 +106,13 @@ Standard library changes
100106

101107
#### Markdown
102108

109+
#### Printf
110+
111+
* Complete overhaul of internal code to use the ryu float printing algorithms (from Julia 1.4); leads to consistent 2-5x performance improvements
112+
* New `Printf.tofloat` function allowing custom float types to more easily integrate with Printf formatting by converting their type to `Float16`, `Float32`, `Float64`, or `BigFloat`
113+
* New `Printf.format"..."` and `Printf.Format(...)` functions that allow creating `Printf.Format` objects that can be passed to `Printf.format` for easier dynamic printf formatting
114+
* `Printf.format(f::Printf.Format, args...)` as a non-macro function that applies a printf format `f` to provided `args`
115+
103116

104117
#### Random
105118

base/Base.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ using .Filesystem
250250
include("cmd.jl")
251251
include("process.jl")
252252
include("ttyhascolor.jl")
253-
include("grisu/grisu.jl")
254253
include("secretbuffer.jl")
255254

256255
# core math functions

base/grisu/bignum.jl

Lines changed: 0 additions & 256 deletions
This file was deleted.

0 commit comments

Comments
 (0)