diff options
author | Robert Griesemer <gri@golang.org> | 2009-08-26 12:55:54 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2009-08-26 12:55:54 -0700 |
commit | c7c535c73149d44df8fe0e4c1d90efb137df8fe9 (patch) | |
tree | 2bb65eb2f1daba6b10f0f86c8f0c3d0a46f442ea /src/pkg/big/nat.go | |
parent | 3450f2fbdb6de7f3ed69f24fe8daf02813192d3e (diff) | |
download | golang-c7c535c73149d44df8fe0e4c1d90efb137df8fe9.tar.gz |
cleanups before making larger changes
R=rsc
DELTA=113 (10 added, 30 deleted, 73 changed)
OCL=33877
CL=33882
Diffstat (limited to 'src/pkg/big/nat.go')
-rw-r--r-- | src/pkg/big/nat.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/pkg/big/nat.go b/src/pkg/big/nat.go index ce9690442..d1b12c753 100644 --- a/src/pkg/big/nat.go +++ b/src/pkg/big/nat.go @@ -6,6 +6,15 @@ // These are the building blocks for the operations on signed integers // and rationals. +// This package implements multi-precision arithmetic (big numbers). +// The following numeric types are supported: +// +// - Int signed integers +// +// All methods on Int take the result as the receiver; if it is one +// of the operands it may be overwritten (and its memory reused). +// To enable chaining of operations, the result is also returned. +// package big // An unsigned integer x of the form @@ -242,9 +251,9 @@ func divNW(z, x []Word, y Word) (q []Word, r Word) { } -// log2 computes the binary logarithm of x. +// log2 computes the integer binary logarithm of x. // The result is the integer n for which 2^n <= x < 2^(n+1). -// If x == 0, the result is < 0. +// If x == 0, the result is -1. func log2(x Word) int { n := 0; for ; x > 0; x >>= 1 { @@ -254,9 +263,9 @@ func log2(x Word) int { } -// log2N computes the binary logarithm of x. +// log2N computes the integer binary logarithm of x. // The result is the integer n for which 2^n <= x < 2^(n+1). -// If x == 0, the result is < 0. +// If x == 0, the result is -1. func log2N(x []Word) int { m := len(x); if m > 0 { |