summaryrefslogtreecommitdiff
path: root/src/pkg/big/int.go
AgeCommit message (Collapse)AuthorFilesLines
2012-04-06Imported Upstream version 1upstream/1Ondřej Surý1-868/+0
2011-09-13Imported Upstream version 60upstream/60Ondřej Surý1-0/+868
2011-09-13Imported Upstream version 60Ondřej Surý1-896/+0
2011-08-03Imported Upstream version 59upstream/59Ondřej Surý1-7/+57
2011-06-30Imported Upstream version 58upstream/58Ondřej Surý1-46/+158
2011-04-26Imported Upstream version 2011.04.13upstream/2011.04.13Ondřej Surý1-50/+43
2011-01-17Imported Upstream version 2011.01.12upstream/2011.01.12Ondřej Surý1-14/+55
2010-06-02big: fix spelling of EuclideanRuss Cox1-2/+2
R=gri CC=golang-dev http://codereview.appspot.com/1372042
2010-05-26big: add ModInverse.Adam Langley1-0/+14
ModInverse is just a small wrapper around GcdInt, but it's nice to have in order to be clear about what one is doing in other code. R=gri, agl1 CC=golang-dev http://codereview.appspot.com/1244045
2010-05-24big: prevent errors in Exp in the face of aliasingAdam Langley1-1/+2
R=gri CC=golang-dev, golang-dev http://codereview.appspot.com/1244044
2010-05-21big: fix Int.SetString comment, simplify implementation,Robert Griesemer1-17/+13
always return z for nat.scan R=rsc CC=golang-dev http://codereview.appspot.com/1236043
2010-05-20big: implemented Int.Binomial (to be used in test/hilbert.go with theRobert Griesemer1-9/+18
forthcoming implementation of big.Rat) R=rsc CC=golang-dev http://codereview.appspot.com/1229047 Committer: Robert Griesemer <gri@golang.org>
2010-05-15big: implemented format support for fmt library, MulRangeRobert Griesemer1-13/+68
- support for binary prefix 0b (to match fmt.Format) - renamed nat.new -> nat.setUint64 for consistency - more tests R=r CC=golang-dev http://codereview.appspot.com/1233041 Committer: Robert Griesemer <gri@golang.org>
2010-05-07big: more cleanupRobert Griesemer1-2/+2
- pass []Word instead of *Word to core arithmetic functions - remove dead code R=rsc CC=golang-dev http://codereview.appspot.com/1154042
2010-05-06big: implemented overlap-tolerant shifts in assemblyRobert Griesemer1-2/+2
- no need to make copies in cases of aliases - removed deprecated internal shift functions - minor unrelated simplifications This change improves pidigits -s -n10000 by almost 20%: user 0m6.156s (old) user 0m4.999s (new) (pidigits -s -n20000 goes from ~25s to ~19s) R=rsc CC=golang-dev http://codereview.appspot.com/1149041
2010-05-03big: completed set of Int division routines & cleanupsRobert Griesemer1-81/+154
- renamed Len -> BitLen, simplified implementation - renamed old Div, Mod, DivMod -> Que, Rem, QuoRem - implemented Div, Mod, DivMod (Euclidian definition, more useful in a mathematical context) - fixed a bug in Exp (-0 was possible) - added extra tests to check normalized results everywhere - uniformly set Int.neg flag at the end of computations - minor cosmetic cleanups - ran all tests R=rsc CC=golang-dev http://codereview.appspot.com/1091041
2010-05-03big: Add bitwise methods for IntEvan Shaw1-0/+142
R=gri CC=golang-dev http://codereview.appspot.com/987041 Committer: Robert Griesemer <gri@golang.org>
2010-04-30big: use fast shift routinesRobert Griesemer1-15/+16
- fixed a couple of bugs in the process (shift right was incorrect for negative numbers) - added more tests and made some tests more robust - changed pidigits back to using shifts to multiply by 2 instead of add This improves pidigit -s -n 10000 by approx. 5%: user 0m6.496s (old) user 0m6.156s (new) R=rsc CC=golang-dev http://codereview.appspot.com/963044
2010-04-27big: implemented Karatsuba multiplicationRobert Griesemer1-3/+3
Plus: - calibration "test" - include in tests with gotest -calibrate - basic Mul benchmark - extra multiplication tests - various cleanups This change improves multiplication speed of numbers >= 30 words in length (current threshold; found empirically with calibrate): The multiplication benchmark (multiplication of a variety of long numbers) improves by ~35%, individual multiplies can be significantly faster. gotest -benchmarks=Mul big.BenchmarkMul 500 6829290 ns/op (w/ Karatsuba) big.BenchmarkMul 100 10600760 ns/op There's no impact on pidigits for -n=10000 or -n=20000 because the operands are are too small. R=rsc CC=golang-dev http://codereview.appspot.com/1004042 Committer: Robert Griesemer <gri@golang.org>
2010-04-22big: Create type natEvan Shaw1-29/+29
Changed most of the functions in nat.go to methods on nat. R=gri CC=golang-dev http://codereview.appspot.com/976041 Committer: Robert Griesemer <gri@golang.org>
2010-04-20big: Add Lsh and Value; convert pidigits to use bigEvan Shaw1-18/+57
This yields a pretty significant performance boost to pidigits and there are still some improvements to be made. Here are my numbers: amd64 w/ bignum: pidigits 10000 gcc -O2 pidigits.c -lgmp 2.10u 0.00s 2.10r gc pidigits 22.92u 0.02s 22.97r gc_B pidigits 22.62u 0.00s 22.65r amd64 w/ big: pidigits 10000 gcc -O2 pidigits.c -lgmp 2.09u 0.02s 2.11r gc pidigits 12.68u 0.04s 12.72r gc_B pidigits 12.71u 0.03s 12.75r 386 w/ bignum: pidigits 10000 gcc -O2 pidigits.c -lgmp 2.09u 0.00s 2.09r gc pidigits 44.30u 0.01s 44.35r gc_B pidigits 44.29u 0.03s 44.35r 386 w/ big: pidigits 10000 gcc -O2 pidigits.c -lgmp 2.10u 0.00s 2.10r gc pidigits 22.70u 0.06s 22.79r gc_B pidigits 22.80u 0.09s 22.91r R=rsc, gri CC=golang-dev http://codereview.appspot.com/881050 Committer: Russ Cox <rsc@golang.org>
2010-03-29comment typosAndrew Gerrand1-3/+3
Fixes issue 698. Fixes issue 699. R=rsc CC=golang-dev http://codereview.appspot.com/824041
2010-01-05big: fix ProbablyPrime bug, commentsRuss Cox1-1/+1
(changes adopted from alc, agl) R=agl1, agl CC=golang-dev http://codereview.appspot.com/181137
2009-12-15 1) Change default gofmt default settings forRobert Griesemer1-118/+118
parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 1st set of files. R=rsc CC=agl, golang-dev, iant, ken2, r http://codereview.appspot.com/180047
2009-11-20gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkgRuss Cox1-3/+3
R=r, gri CC=golang-dev http://codereview.appspot.com/156115
2009-11-11Reland a112249da741, this time with missing file.Adam Langley1-83/+24
2009-11-11roll back 3985: build is brokenRuss Cox1-24/+83
TBR=agl1 CC=golang-dev http://codereview.appspot.com/154065
2009-11-11big:Adam Langley1-83/+24
Turn methods that don't store the result in their receiver into functions in order to preserve the convention. Re-jig Exp and Div by moving their guts into nat.go. Add ProbablyPrime to perform Miller-Rabin primality tests. crypto/rsa: reenable key generation since we now have ProbablyPrime. R=gri CC=go-dev http://codereview.prom.corp.google.com/1024038
2009-11-09- replaced gofmt expression formatting algorithm withRobert Griesemer1-5/+5
rsc's algorithm - applied gofmt -w misc src - partial CL (remaining files in other CLs) R=rsc, r http://go/go-review/1024040
2009-11-09remove semis after statements in one-statement statement listsRobert Griesemer1-23/+23
R=rsc, r http://go/go-review/1025029
2009-11-06- fine-tuning of one-line func heuristic (nodes.go)Robert Griesemer1-3/+1
- enabled for function declarations (not just function literals) - applied gofmt -w $GOROOT/src (look for instance at src/pkg/debug/elf/elf.go) R=r, rsc CC=go-dev http://go/go-review/1026006
2009-11-05big: add Div, Mod, Exp, GcdExt and several other fixes.Adam Langley1-3/+293
R=gri, rsc CC=go-dev http://go/go-review/1017036
2009-10-06apply gofmt to the LGTM-marked files from 34501Russ Cox1-9/+9
that have not changed since I applied gofmt. R=gri DELTA=456 (77 added, 3 deleted, 376 changed) OCL=35378 CL=35383
2009-08-18- implemented MultiplicationRobert Griesemer1-7/+9
- changed Cmp to return -1, 0, +1 - added corresponding test cases R=rsc DELTA=173 (136 added, 3 deleted, 34 changed) OCL=33431 CL=33459
2009-08-17- rename files to match the data types they implement, adusted MakefileRobert Griesemer1-0/+139
- no other changes R=r DELTA=1248 (623 added, 623 deleted, 2 changed) OCL=33371 CL=33371