]> Cypherpunks repositories - gostls13.git/commit
strconv: faster FormatFloat(x, *, -1, 64) using Grisu3 algorithm.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Fri, 13 Jan 2012 22:24:33 +0000 (23:24 +0100)
committerRémy Oudompheng <oudomphe@phare.normalesup.org>
Fri, 13 Jan 2012 22:24:33 +0000 (23:24 +0100)
commit0575cd9de45215c069ffb15afe11599dcb409f62
treeff9313864235b08eeb072ae75ccdb737fbb737d3
parenta5950df89e129e93f76aa8391f84beb460ef82be
strconv: faster FormatFloat(x, *, -1, 64) using Grisu3 algorithm.

The implementation is similar to the one from the double-conversion
library used in the Chrome V8 engine.

                            old ns/op   new ns/op  speedup
BenchmarkAppendFloatDecimal      591         480      1.2x
BenchmarkAppendFloat            2956         486      6.1x
BenchmarkAppendFloatExp        10622         503     21.1x
BenchmarkAppendFloatNegExp     40343         483     83.5x
BenchmarkAppendFloatBig         2798         664      4.2x

See F. Loitsch, ``Printing Floating-Point Numbers Quickly and
Accurately with Integers'', Proceedings of the ACM, 2010.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/5502079
src/pkg/strconv/extfloat.go
src/pkg/strconv/ftoa.go
src/pkg/strconv/ftoa_test.go