Robert Griesemer
465b9c35e5
gofmt: apply gofmt -w src misc
...
Remove trailing whitespace in comments.
No other changes.
R=r
CC=golang-dev
https://golang.org/cl/6815053
2012-10-30 13:38:01 -07:00
Adam Langley
73f11171b4
math/big: add 4-bit, fixed window exponentiation.
...
A 4-bit window is convenient because 4 divides both 32 and 64,
therefore we never have a window spanning words of the exponent.
Additionaly, the benefit of a 5-bit window is only 2.6% at 1024-bits
and 3.3% at 2048-bits.
This code is still not constant time, however.
benchmark old ns/op new ns/op delta
BenchmarkRSA2048Decrypt 17108590 11180370 -34.65%
Benchmark3PrimeRSA2048Decrypt 13003720 7680390 -40.94%
R=gri
CC=golang-dev
https://golang.org/cl/6716048
2012-10-17 11:19:26 -04:00
Robert Griesemer
7565726875
math/big: fix big.Exp and document better
...
- always return 1 for y <= 0
- document that the sign of m is ignored
- protect against div-0 panics by treating
m == 0 the same way as m == nil
- added extra tests
Fixes #4239 .
R=agl, remyoudompheng, agl
CC=golang-dev
https://golang.org/cl/6724046
2012-10-16 13:46:27 -07:00
Robert Griesemer
4bee88d45f
math/big: more conservative use of lock for divisor table
...
Minor performance impact running sequentially:
benchmark old ns/op new ns/op delta
BenchmarkString10Base2 389 391 +0.51%
BenchmarkString100Base2 1530 1534 +0.26%
BenchmarkString1000Base2 11789 11787 -0.02%
BenchmarkString10000Base2 111443 112030 +0.53%
BenchmarkString100000Base2 1017483 1015347 -0.21%
BenchmarkString10Base8 339 344 +1.47%
BenchmarkString100Base8 753 756 +0.40%
BenchmarkString1000Base8 4618 4641 +0.50%
BenchmarkString10000Base8 43217 43534 +0.73%
BenchmarkString100000Base8 397518 400602 +0.78%
BenchmarkString10Base10 630 630 +0.00%
BenchmarkString100Base10 1975 1960 -0.76%
BenchmarkString1000Base10 10179 10174 -0.05%
BenchmarkString10000Base10 44527 44416 -0.25%
BenchmarkString100000Base10 14404694 14425308 +0.14%
BenchmarkString10Base16 283 288 +1.77%
BenchmarkString100Base16 597 598 +0.17%
BenchmarkString1000Base16 3189 3186 -0.09%
BenchmarkString10000Base16 29403 29364 -0.13%
BenchmarkString100000Base16 265657 265587 -0.03%
Note that due to other improvements (faster assembly routines,
better code generation by compiler), these benchmarks now run
up to 37% faster than they used to at the last time measured (1/9/2012).
Minor performance impact for StringPiParallel running in parallel:
Current CL but with Lock/Unlock commented out (removed):
BenchmarkStringPiParallel 5000 343581 ns/op
BenchmarkStringPiParallel-2 10000 184511 ns/op
BenchmarkStringPiParallel-3 10000 129768 ns/op
BenchmarkStringPiParallel-4 10000 102326 ns/op
Current CL:
BenchmarkStringPiParallel 5000 345169 ns/op
BenchmarkStringPiParallel-2 10000 185827 ns/op
BenchmarkStringPiParallel-3 10000 131168 ns/op
BenchmarkStringPiParallel-4 10000 102353 ns/op
Fixes #4218 .
R=dvyukov, michael.jones, dave
CC=golang-dev
https://golang.org/cl/6643053
2012-10-11 16:04:03 -07:00
Adam Langley
9070d5759f
math/big: avoid some allocation in Exp
...
benchmark old ns/op new ns/op delta
BenchmarkRSA1024Decrypt 745686 644964 -13.51%
BenchmarkRSA2048Decrypt 5517318 5049200 -8.48%
Benchmark3PrimeRSA2048Decrypt 3767386 3288048 -12.72%
R=gri
CC=gobot, golang-dev
https://golang.org/cl/6566043
2012-10-01 17:31:35 -04:00
Russ Cox
10ea6519e4
build: make int 64 bits on amd64
...
The assembly offsets were converted mechanically using
code.google.com/p/rsc/cmd/asmlint. The instruction
changes were done by hand.
Fixes #2188 .
R=iant, r, bradfitz, remyoudompheng
CC=golang-dev
https://golang.org/cl/6550058
2012-09-24 20:57:01 -04:00
Russ Cox
8572950383
all: match asm variable names to Go func declarations
...
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6548046
2012-09-21 00:35:56 -04:00
Charles L. Dorian
0f8f5d2140
math: Faster Tanh
...
From 159 to 47.6 ns/op; slightly more accurate.
R=rsc, golang-dev, mtj, dave, remyoudompheng
CC=golang-dev
https://golang.org/cl/6500121
2012-09-17 17:18:16 -04:00
Christopher Swenson
baf426f10f
math/big: Replace RCLQ + ANDQ with SETCS in unrolled arithmetic assembly.
...
benchmark old ns/op new ns/op delta
BenchmarkAddVW_1 8 8 +0.60%
BenchmarkAddVW_2 10 9 -8.64%
BenchmarkAddVW_3 10 10 -4.63%
BenchmarkAddVW_4 10 11 +3.67%
BenchmarkAddVW_5 11 12 +5.98%
BenchmarkAddVW_1e1 18 20 +6.38%
BenchmarkAddVW_1e2 129 115 -10.85%
BenchmarkAddVW_1e3 1270 1089 -14.25%
BenchmarkAddVW_1e4 13376 12145 -9.20%
BenchmarkAddVW_1e5 130392 125260 -3.94%
benchmark old MB/s new MB/s speedup
BenchmarkAddVW_1 7709.10 7661.92 0.99x
BenchmarkAddVW_2 12451.10 13604.00 1.09x
BenchmarkAddVW_3 17727.81 18721.54 1.06x
BenchmarkAddVW_4 23552.64 22708.81 0.96x
BenchmarkAddVW_5 27411.40 25816.22 0.94x
BenchmarkAddVW_1e1 34063.19 32023.06 0.94x
BenchmarkAddVW_1e2 49529.97 55360.55 1.12x
BenchmarkAddVW_1e3 50380.44 58764.18 1.17x
BenchmarkAddVW_1e4 47843.59 52696.10 1.10x
BenchmarkAddVW_1e5 49082.60 51093.66 1.04x
R=gri, rsc, r
CC=golang-dev
https://golang.org/cl/6480063
2012-08-28 09:29:45 -07:00
Robert Griesemer
74c6325142
math/big: fix broken comment
...
R=iant, iant
CC=golang-dev
https://golang.org/cl/6485064
2012-08-24 13:50:09 -07:00
Robert Griesemer
3bd8684fac
math/big: minor tweaks to assembly code (slightly better performance)
...
Benchmarks run on 2.8GHz Quad-Code Intel Xeon,
4GB 800MHz DDR2 FB-DIMM ("PowerMac").
benchmark old ns/op new ns/op delta
BenchmarkAddVV_1 7 7 -0.82%
BenchmarkAddVV_2 8 8 -3.46%
BenchmarkAddVV_3 10 9 -4.81%
BenchmarkAddVV_4 9 9 -1.89%
BenchmarkAddVV_5 11 10 -5.22%
BenchmarkAddVV_1e1 17 18 +4.05%
BenchmarkAddVV_1e2 117 115 -1.71%
BenchmarkAddVV_1e3 1095 1090 -0.46%
BenchmarkAddVV_1e4 13149 12679 -3.57%
BenchmarkAddVV_1e5 135133 129482 -4.18%
BenchmarkAddVW_1 6 6 -1.14%
BenchmarkAddVW_2 7 7 +3.78%
BenchmarkAddVW_3 8 8 +0.12%
BenchmarkAddVW_4 8 8 -6.52%
BenchmarkAddVW_5 9 8 -3.70%
BenchmarkAddVW_1e1 14 13 -4.29%
BenchmarkAddVW_1e2 97 96 -1.33%
BenchmarkAddVW_1e3 953 940 -1.36%
BenchmarkAddVW_1e4 9776 9527 -2.55%
BenchmarkAddVW_1e5 102396 97738 -4.55%
benchmark old MB/s new MB/s speedup
BenchmarkAddVV_1 8702.84 8774.56 1.01x
BenchmarkAddVV_2 14739.60 15277.82 1.04x
BenchmarkAddVV_3 18375.37 19398.16 1.06x
BenchmarkAddVV_4 26935.44 27464.68 1.02x
BenchmarkAddVV_5 27754.04 29423.30 1.06x
BenchmarkAddVV_1e1 37050.89 35629.72 0.96x
BenchmarkAddVV_1e2 54289.15 55533.24 1.02x
BenchmarkAddVV_1e3 58428.83 58682.53 1.00x
BenchmarkAddVV_1e4 48670.55 50475.99 1.04x
BenchmarkAddVV_1e5 47360.54 49427.66 1.04x
BenchmarkAddVW_1 10397.27 10502.23 1.01x
BenchmarkAddVW_2 17279.03 16654.13 0.96x
BenchmarkAddVW_3 23858.39 23825.89 1.00x
BenchmarkAddVW_4 29799.42 31895.06 1.07x
BenchmarkAddVW_5 34781.83 36105.11 1.04x
BenchmarkAddVW_1e1 45629.88 47597.42 1.04x
BenchmarkAddVW_1e2 65341.93 66240.04 1.01x
BenchmarkAddVW_1e3 67153.67 68069.83 1.01x
BenchmarkAddVW_1e4 65464.60 67173.83 1.03x
BenchmarkAddVW_1e5 62501.88 65480.66 1.05x
R=iant
CC=golang-dev
https://golang.org/cl/6484056
2012-08-24 10:51:39 -07:00
Robert Griesemer
35422bc11f
math/big: faster (add|sub)V(V|W) routines
...
Benchmarks run on 3.06GHz Intel Core 2 Duo,
4GB 800MHz DDR2 SDRAM ("iMac").
benchmark old ns/op new ns/op delta
BenchmarkAddVV_1 6 6 +2.75%
BenchmarkAddVV_2 9 7 -19.71%
BenchmarkAddVV_3 9 9 +2.25%
BenchmarkAddVV_4 10 8 -20.46%
BenchmarkAddVV_5 12 10 -19.53%
BenchmarkAddVV_1e1 23 15 -32.48%
BenchmarkAddVV_1e2 213 107 -49.77%
BenchmarkAddVV_1e3 2088 993 -52.44%
BenchmarkAddVV_1e4 20874 12027 -42.38%
BenchmarkAddVV_1e5 209858 121480 -42.11%
BenchmarkAddVW_1 5 5 +0.90%
BenchmarkAddVW_2 11 11 -3.51%
BenchmarkAddVW_3 7 7 -0.27%
BenchmarkAddVW_4 8 7 -6.32%
BenchmarkAddVW_5 9 8 -10.89%
BenchmarkAddVW_1e1 17 12 -26.01%
BenchmarkAddVW_1e2 155 89 -42.32%
BenchmarkAddVW_1e3 1479 873 -40.97%
BenchmarkAddVW_1e4 13838 8764 -36.67%
BenchmarkAddVW_1e5 147353 89560 -39.22%
benchmark old MB/s new MB/s speedup
BenchmarkAddVV_1 9765.57 9508.55 0.97x
BenchmarkAddVV_2 13077.63 16284.97 1.25x
BenchmarkAddVV_3 20599.58 20156.67 0.98x
BenchmarkAddVV_4 23591.58 29516.02 1.25x
BenchmarkAddVV_5 24920.95 31194.10 1.25x
BenchmarkAddVV_1e1 27393.76 40621.71 1.48x
BenchmarkAddVV_1e2 29911.96 59592.99 1.99x
BenchmarkAddVV_1e3 30650.73 64429.84 2.10x
BenchmarkAddVV_1e4 30660.09 53213.08 1.74x
BenchmarkAddVV_1e5 30496.74 52683.46 1.73x
BenchmarkAddVW_1 11503.39 11405.98 0.99x
BenchmarkAddVW_2 11203.56 11586.92 1.03x
BenchmarkAddVW_3 26173.45 26224.75 1.00x
BenchmarkAddVW_4 30560.30 32621.94 1.07x
BenchmarkAddVW_5 33183.81 37269.94 1.12x
BenchmarkAddVW_1e1 36991.75 50098.53 1.35x
BenchmarkAddVW_1e2 41087.14 71549.93 1.74x
BenchmarkAddVW_1e3 43266.42 73279.83 1.69x
BenchmarkAddVW_1e4 46246.74 73021.97 1.58x
BenchmarkAddVW_1e5 43433.00 71459.96 1.65x
Benchmarks run on 2.8GHz Quad-Code Intel Xeon,
4GB 800MHz DDR2 FB-DIMM ("PowerMac").
benchmark old ns/op new ns/op delta
BenchmarkAddVV_1 7 7 +2.51%
BenchmarkAddVV_2 8 8 +3.70%
BenchmarkAddVV_3 10 10 +4.00%
BenchmarkAddVV_4 11 9 -19.49%
BenchmarkAddVV_5 14 11 -18.44%
BenchmarkAddVV_1e1 23 17 -27.00%
BenchmarkAddVV_1e2 234 117 -50.00%
BenchmarkAddVV_1e3 2284 1095 -52.06%
BenchmarkAddVV_1e4 22906 13149 -42.60%
BenchmarkAddVV_1e5 229860 135133 -41.21%
BenchmarkAddVW_1 6 6 +1.15%
BenchmarkAddVW_2 7 7 +1.37%
BenchmarkAddVW_3 7 8 +1.00%
BenchmarkAddVW_4 9 8 -6.93%
BenchmarkAddVW_5 10 9 -13.21%
BenchmarkAddVW_1e1 18 14 -24.32%
BenchmarkAddVW_1e2 170 97 -42.41%
BenchmarkAddVW_1e3 1619 953 -41.14%
BenchmarkAddVW_1e4 15142 9776 -35.44%
BenchmarkAddVW_1e5 160835 102396 -36.33%
benchmark old MB/s new MB/s speedup
BenchmarkAddVV_1 8928.95 8702.84 0.97x
BenchmarkAddVV_2 15298.84 14739.60 0.96x
BenchmarkAddVV_3 19116.52 18375.37 0.96x
BenchmarkAddVV_4 21644.30 26935.44 1.24x
BenchmarkAddVV_5 22771.64 27754.04 1.22x
BenchmarkAddVV_1e1 27017.62 37050.89 1.37x
BenchmarkAddVV_1e2 27326.09 54289.15 1.99x
BenchmarkAddVV_1e3 28016.84 58428.83 2.09x
BenchmarkAddVV_1e4 27939.38 48670.55 1.74x
BenchmarkAddVV_1e5 27843.00 47360.54 1.70x
BenchmarkAddVW_1 10510.97 10397.27 0.99x
BenchmarkAddVW_2 17499.71 17279.03 0.99x
BenchmarkAddVW_3 24093.93 23858.39 0.99x
BenchmarkAddVW_4 27733.08 29799.42 1.07x
BenchmarkAddVW_5 30267.17 34781.83 1.15x
BenchmarkAddVW_1e1 34566.78 45629.88 1.32x
BenchmarkAddVW_1e2 37521.89 65341.93 1.74x
BenchmarkAddVW_1e3 39513.18 67153.67 1.70x
BenchmarkAddVW_1e4 42263.80 65464.60 1.55x
BenchmarkAddVW_1e5 39792.21 62501.88 1.57x
R=iant, remyoudompheng, nightlyone, minux.ma
CC=golang-dev
https://golang.org/cl/6482062
2012-08-24 09:20:44 -07:00
Robert Griesemer
053b448d61
math/big: added benchmarks to establish baseline for core functions
...
BenchmarkAddVV_1 500000000 7.24 ns/op 8844.11 MB/s
BenchmarkAddVV_2 100000000 10.4 ns/op 12290.41 MB/s
BenchmarkAddVV_3 100000000 10.7 ns/op 17966.58 MB/s
BenchmarkAddVV_4 100000000 12.3 ns/op 20848.67 MB/s
BenchmarkAddVV_5 100000000 14.5 ns/op 21993.82 MB/s
BenchmarkAddVV_1e1 100000000 24.0 ns/op 26720.65 MB/s
BenchmarkAddVV_1e2 10000000 246 ns/op 26014.58 MB/s
BenchmarkAddVV_1e3 1000000 2416 ns/op 26485.06 MB/s
BenchmarkAddVV_1e4 100000 23874 ns/op 26806.36 MB/s
BenchmarkAddVV_1e5 10000 241155 ns/op 26538.87 MB/s
BenchmarkAddVW_1 500000000 6.12 ns/op 10461.91 MB/s
BenchmarkAddVW_2 200000000 11.0 ns/op 11596.63 MB/s
BenchmarkAddVW_3 200000000 8.97 ns/op 21409.82 MB/s
BenchmarkAddVW_4 100000000 10.8 ns/op 23696.72 MB/s
BenchmarkAddVW_5 100000000 12.5 ns/op 25524.88 MB/s
BenchmarkAddVW_1e1 100000000 21.5 ns/op 29786.32 MB/s
BenchmarkAddVW_1e2 10000000 168 ns/op 37925.36 MB/s
BenchmarkAddVW_1e3 1000000 1658 ns/op 38579.15 MB/s
BenchmarkAddVW_1e4 100000 16492 ns/op 38805.85 MB/s
BenchmarkAddVW_1e5 10000 172155 ns/op 37175.69 MB/s
BenchmarkAddMulVVW_1 100000000 12.9 ns/op 4968.49 MB/s
BenchmarkAddMulVVW_2 100000000 15.5 ns/op 8279.42 MB/s
BenchmarkAddMulVVW_3 100000000 13.4 ns/op 14340.53 MB/s
BenchmarkAddMulVVW_4 100000000 15.8 ns/op 16194.94 MB/s
BenchmarkAddMulVVW_5 100000000 18.9 ns/op 16906.61 MB/s
BenchmarkAddMulVVW_1e1 50000000 32.3 ns/op 19838.35 MB/s
BenchmarkAddMulVVW_1e2 10000000 285 ns/op 22427.28 MB/s
BenchmarkAddMulVVW_1e3 1000000 2777 ns/op 23040.42 MB/s
BenchmarkAddMulVVW_1e4 100000 27901 ns/op 22938.01 MB/s
BenchmarkAddMulVVW_1e5 10000 281087 ns/op 22768.73 MB/s
R=r
CC=golang-dev
https://golang.org/cl/6478055
2012-08-23 15:56:14 -07:00
Charles L. Dorian
a5c4e0fa2a
math: update definition of NaN in assembly language files
...
R=rsc, minux.ma, golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6461047
2012-08-09 09:40:05 +10:00
Shenghou Ma
6e9506a7b4
math, runtime: use a NaN that matches gcc's
...
our old choice is not working properly at least on VFPv2 in
ARM1136JF-S (it's not preserved across float64->float32 conversions).
Fixes #3745 .
R=dave, rsc
CC=golang-dev
https://golang.org/cl/6344078
2012-08-07 09:57:14 +08:00
Robert Griesemer
6a135a0894
mat/big: more optimal Karatsuba threshold
...
benchmark old ns/op new ns/op delta
BenchmarkHilbert 6253043 6267289 +0.23%
BenchmarkMul 45355940 39490633 -12.93%
R=r
CC=golang-dev
https://golang.org/cl/6355104
2012-07-12 14:19:09 -07:00
Robert Griesemer
98ca655919
math/big: minor performance tuning
...
Reuse temporary slice to avoid extra allocations
(originally done correctly by remyoudompheng@gmail.com
in https://golang.org/cl/6345075/ ).
benchmark old ns/op new ns/op delta
BenchmarkHilbert 6252790 6262304 +0.15%
BenchmarkMul 45827438 45301002 -1.15%
R=r
CC=golang-dev
https://golang.org/cl/6346097
2012-07-12 14:12:50 -07:00
Rémy Oudompheng
ac12131649
math/big: correct quadratic space complexity in Mul.
...
The previous implementation used to have a O(n) recursion
depth for unbalanced inputs. A test is added to check that a
reasonable amount of bytes is allocated in this case.
Fixes #3807 .
R=golang-dev, dsymonds, gri
CC=golang-dev, remy
https://golang.org/cl/6345075
2012-07-12 10:18:24 -07:00
Matthew William Jibson
f83a47cbb9
doc: various "the the" and other typos
...
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6355076
2012-07-08 11:57:04 +10:00
Rémy Oudompheng
1a0a09dafe
math/rand: avoid use of math.Pow in tests.
...
The use of math.Pow for mere squaring can be extremely
slow on soft-float ARM. Even on systems with hardware
floating-point, a speedup in test duration is observed.
On amd64
Before: ok math/rand 2.009s
After: ok math/rand 0.340s
Fixes #3740 .
R=dave, golang-dev, r, r
CC=golang-dev
https://golang.org/cl/6348061
2012-07-04 00:38:01 +02:00
David G. Andersen
917f764382
math/big: Remove unnecessary test from nat.go multiplication
...
The switch at the beginning of the function already ensures n > 1,
so testing for n < 2 is redundant.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/6350051
2012-07-02 15:30:00 -07:00
Charles L. Dorian
35c3afdb62
math: improve Atan, Asin and Acos accuracy
...
pkg/math/all_test.go tests Atan (and therefore Asin and Acos) to a
relative accuracy of 4e-16, but the test vector misses values where
the old algorithm was in error by more than that. For example:
x newError oldError
0.414215746 1.41e-16 -4.24e-16
0.414216076 1.41e-16 -4.24e-16
0.414217632 1.41e-16 -4.24e-16
0.414218770 1.41e-16 -4.24e-16
0.414225466 0 -5.65e-16
0.414226244 1.41e-16 -4.24e-16
0.414228756 0 -5.65e-16
0.414235089 0 -5.65e-16
0.414237070 0 -5.65e-16
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6302093
2012-06-24 19:39:07 -04:00
Robert Griesemer
10b88888f6
math/big: correctly test for positive inputs in Int.GCD
...
Also: better GCD tests.
R=rsc
CC=golang-dev
https://golang.org/cl/6295076
2012-06-13 13:54:36 -07:00
Robert Griesemer
f4240666be
math/big: fix binaryGCD
...
R=rsc
CC=golang-dev
https://golang.org/cl/6297085
2012-06-13 10:29:06 -07:00
Robert Griesemer
b7c5e23df0
math/big: various cleanups
...
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6295072
2012-06-13 09:37:47 -07:00
Christopher Swenson
38735b957c
math/big: Implemented binary GCD algorithm
...
benchmark old ns/op new ns/op delta
BenchmarkGCD10x10 4383 2126 -51.49%
BenchmarkGCD10x100 5612 2124 -62.15%
BenchmarkGCD10x1000 8843 2622 -70.35%
BenchmarkGCD10x10000 17025 6576 -61.37%
BenchmarkGCD10x100000 118985 48130 -59.55%
BenchmarkGCD100x100 45328 11683 -74.23%
BenchmarkGCD100x1000 50141 12678 -74.72%
BenchmarkGCD100x10000 110314 26719 -75.78%
BenchmarkGCD100x100000 630000 156041 -75.23%
BenchmarkGCD1000x1000 654809 137973 -78.93%
BenchmarkGCD1000x10000 985683 159951 -83.77%
BenchmarkGCD1000x100000 4920792 366399 -92.55%
BenchmarkGCD10000x10000 16848950 3732062 -77.85%
BenchmarkGCD10000x100000 55401500 4675876 -91.56%
BenchmarkGCD100000x100000 1126775000 258951800 -77.02%
R=gri, rsc, bradfitz, remyoudompheng, mtj
CC=golang-dev
https://golang.org/cl/6305065
2012-06-13 09:31:20 -07:00
Robert Griesemer
008c62b2cd
math/big: optimize common case of Int.Bit(0)
...
R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/6306069
2012-06-12 09:36:35 -07:00
Robert Griesemer
014d036d84
math/big: added nat.trailingZeroBits, simplified some code
...
Will simplify implementation of binaryGCD.
R=rsc, cswenson
CC=golang-dev
https://golang.org/cl/6299064
2012-06-08 13:00:49 -07:00
Robert Griesemer
cc1890cbe3
math/big: improved karatsuba calibration code, better mul benchmark
...
An attempt to profit from CL 6176043 (fix to superpolinomial
runtime of karatsuba multiplication) and determine a better
karatsuba threshold. The result indicates that 32 is still
a reasonable value. Left the threshold as is (== 32), but
made some minor changes to the calibrate code which are
worthwhile saving (use of existing benchmarking code for
better results, better use of package time).
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6260062
2012-06-04 09:48:27 -07:00
Shenghou Ma
d186d07eda
cmd/5a, cmd/5l, math: add CLZ instruction for ARM
...
Supported in ARMv5 and above.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6284043
2012-06-03 03:08:49 +08:00
Charles L. Dorian
322057cbfc
math: amd64 versions of Ceil, Floor and Trunc
...
Ceil to 4.81 from 20.6 ns/op
Floor to 4.37 from 13.5 ns/op
Trunc to 3.97 from 14.3 ns/op
Also changed three MOVSDs to MOVAPDs in log_amd64.s
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6262048
2012-06-02 13:06:12 -04:00
Robert Griesemer
07612b8db0
math/big: make Rat.Denom() always return a reference
...
The documentation says so, but in the case of a normalized
integral Rat, the denominator was a new value. Changed the
internal representation to use an Int to represent the
denominator (with the sign ignored), so a reference to it
can always be returned.
Clarified documentation and added test cases.
Fixes #3521 .
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6237045
2012-05-24 10:49:38 -07:00
Robert Griesemer
13a59b8c6d
math/big: implement JSON un/marshaling support for Ints
...
Also: simplified some existing tests.
No support for Rats for now because the precision-preserving
default notation (fractions of the form a/b) is not a valid
JSON value.
Fixes #3657 .
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6211079
2012-05-22 17:20:37 -07:00
Rémy Oudompheng
018c60bd8f
math/big: fix superpolynomial complexity in Karatsuba algorithm.
...
benchmark old ns/op new ns/op delta
BenchmarkExp3Power0x10 732 734 +0.27%
BenchmarkExp3Power0x40 834 836 +0.24%
BenchmarkExp3Power0x100 1600 1579 -1.31%
BenchmarkExp3Power0x400 3478 3417 -1.75%
BenchmarkExp3Power0x1000 19388 19229 -0.82%
BenchmarkExp3Power0x4000 160274 156881 -2.12%
BenchmarkExp3Power0x10000 1552050 1372058 -11.60%
BenchmarkExp3Power0x40000 27328710 15216920 -44.32%
BenchmarkExp3Power0x100000 612349000 131407100 -78.54%
BenchmarkExp3Power0x400000 44073524000 1122195000 -97.45%
R=golang-dev, mtj, gri, rsc
CC=golang-dev, remy
https://golang.org/cl/6176043
2012-05-04 19:05:26 +02:00
Shenghou Ma
e7e7b1c55c
math: ARM assembly implementation for Abs
...
Obtained on 700MHz OMAP4460:
benchmark old ns/op new ns/op delta
BenchmarkAbs 61 23 -61.63%
R=dave, remyoudompheng, mtj, rsc
CC=golang-dev
https://golang.org/cl/6094047
2012-04-23 23:47:36 +08:00
Charles L. Dorian
f27348776f
math: make function documentation more regular
...
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5994043
2012-04-06 14:01:12 -04:00
Charles L. Dorian
5496e94187
math: update Gamma special cases
...
Match new C99 values for special cases.
Fixes #2977 .
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5972058
2012-04-04 09:45:22 -04:00
Robert Griesemer
d724631a53
all: various typos
...
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5820045
2012-03-13 17:29:07 -07:00
Robert Griesemer
28e0e18863
math: slightly more readable comments
...
Replaced /*-style comments with line comments;
there are two many *'s already in those lines.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5699051
2012-02-23 10:17:24 -08:00
Russ Cox
0e70f2722b
all: shorten some of the longer tests
...
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5675092
2012-02-18 16:24:23 -05:00
Rob Pike
7d1c5328ed
math/rand: Intn etc. should panic if their argument is <= 0.
...
I am making a unilateral decision here. I could also settle for returning 0,
as long it's documented, but I argue that it's equivalent to an index
out of bounds.
Fixes #2892 .
R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5676079
2012-02-18 08:53:03 +11:00
Andrew Gerrand
11e113db57
godoc: make example code more readable with new comment convention
...
go/doc: move Examples to go/ast
cmd/go: use go/doc to read examples
src/pkg: update examples to use new convention
This is to make whole file examples more readable. When presented as a
complete function, preceding an Example with its output is confusing.
The new convention is to put the expected output in the final comment
of the example, preceded by the string "output:" (case insensitive).
An idiomatic example looks like this:
// This example demonstrates Foo by doing bar and quux.
func ExampleFoo() {
// example body that does bar and quux
// Output:
// example output
}
R=rsc, gri
CC=golang-dev
https://golang.org/cl/5673053
2012-02-16 11:50:28 +11:00
Shenghou Ma
9a4487458a
all: update 'gotest' to 'go test'
...
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5645099
2012-02-13 13:58:17 -05:00
Rob Pike
13443ccc2a
math: fix gamma doc, link to OEIS
...
Fixes #2940 .
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5645078
2012-02-10 15:56:51 +11:00
Robert Griesemer
d0607221fa
math/big: more accurate package comment
...
Fix some receiver names for consistency.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5624043
2012-02-03 10:17:19 -08:00
Robert Griesemer
b80c7e5dfd
math/big: API, documentation cleanup
...
Fixes #2863 .
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5620058
2012-02-02 19:21:55 -08:00
Robert Griesemer
25787acb3c
math/big: document Word type
...
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5615050
2012-02-02 14:43:55 -08:00
Robert Griesemer
71c19b610f
mat/big: add raw access to Int bits
...
This is a minimal API extension, it makes it possible
to implement missing Int functionality externally w/o
compromising efficiency. It is the hope that this will
reduce the number of feature requests going directly
into the big package.
Also: Fixed some naming inconsistencies: The receiver
is only called z when it is also the result.
R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/5607055
2012-02-01 11:43:40 -08:00
Luuk van Dijk
8dd3de4d4b
pkg/math: undo manual inlining of IsInf and IsNaN
...
R=rsc
CC=golang-dev
https://golang.org/cl/5484076
2012-02-01 16:08:31 +01:00
Russ Cox
2050a9e478
build: remove Make.pkg, Make.tool
...
Consequently, remove many package Makefiles,
and shorten the few that remain.
gomake becomes 'go tool make'.
Turn off test phases of run.bash that do not work,
flagged with $BROKEN. Future CLs will restore these,
but this seemed like a big enough CL already.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5601057
2012-01-30 23:43:46 -05:00