• Martin Möhrmann's avatar
    math: speed up and improve accuracy of Pow10 · 8c664384
    Martin Möhrmann authored
    Removes init function from the math package.
    
    Allows stripping of arrays with pre-computed values
    used for Pow10 from binaries if Pow10 is not used.
    cmd/go shrinks by 128 bytes.
    
    Fixed small values like 10**-323 being 0 instead of 1e-323.
    
    Overall precision is increased but still not as good as
    predefined constants for some inputs.
    
    Samples:
    
    Pow10(208)
    before: 1.0000000000000006662e+208
    after:  1.0000000000000000959e+208
    
    Pow10(202)
    before 1.0000000000000009895e+202
    after  1.0000000000000001193e+202
    
    Pow10(60)
    before 1.0000000000000001278e+60
    after  0.9999999999999999494e+60
    
    Pow10(-100)
    before 0.99999999999999938551e-100
    after  0.99999999999999989309e-100
    
    Pow10(-200)
    before 0.9999999999999988218e-200
    after  1.0000000000000001271e-200
    
    name        old time/op  new time/op  delta
    Pow10Pos-4  44.6ns ± 2%   1.2ns ± 1%  -97.39%  (p=0.000 n=19+17)
    Pow10Neg-4  50.8ns ± 1%   4.1ns ± 2%  -92.02%  (p=0.000 n=17+19)
    
    Change-Id: If094034286b8ac64be3a95fd9e8ffa3d4ad39b31
    Reviewed-on: https://go-review.googlesource.com/36331Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
    Run-TryBot: Martin Möhrmann <moehrmann@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    8c664384
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...