big: Improvements to Rat.SetString
* Allow an exponent part. This is necessary for exp/eval.
* Fix a bug for input that had no numbers after the decimal.
* In Int.SetString, allow a leading + sign.
* In Int.SetString, error if the input is "-" with no number.
* In nat.scan, normalize the resulting nat.
R=gri
CC=golang-dev
https://golang.org/cl/1733045
diff --git a/src/pkg/big/nat.go b/src/pkg/big/nat.go
index dc2e6be..72d9f05 100755
--- a/src/pkg/big/nat.go
+++ b/src/pkg/big/nat.go
@@ -103,9 +103,7 @@
func (z nat) set(x nat) nat {
z = z.make(len(x))
- for i, d := range x {
- z[i] = d
- }
+ copy(z, x)
return z
}
@@ -666,7 +664,7 @@
}
}
- return z, base, i
+ return z.norm(), base, i
}