]> Cypherpunks repositories - gostls13.git/commit
fmt: remove math package dependency and avoid float operations
authorMartin Möhrmann <martisch@uos.de>
Fri, 19 Feb 2016 21:45:38 +0000 (22:45 +0100)
committerRob Pike <r@golang.org>
Fri, 19 Feb 2016 22:55:30 +0000 (22:55 +0000)
commit5a9c128a0313df72973259bea946262cb8973d86
treebf93c6c3747c30bbda6325c875414ae0428e5918
parent113c4d25818e67599d3ff647480e4e68d6857f82
fmt: remove math package dependency and avoid float operations

Remove floating point comparisons and rely only on the information
directly provided by appendFloat.
Make restoring the zero padding flag explicit instead of using a defer.
Rearrange some case distinctions to remove duplicated code.
Add more test cases for zero padded floating point numbers with sign.

benchmark                   old ns/op     new ns/op     delta
BenchmarkSprintfFloat-4     187           180           -3.74%

Change-Id: Ifa2ae85257909f40b1b18118c92b516933271729
Reviewed-on: https://go-review.googlesource.com/19721
Reviewed-by: Rob Pike <r@golang.org>
src/fmt/fmt_test.go
src/fmt/format.go