1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
24 func extractDigit() int64 {
25 if big
.CmpInt(numer
, accum
) > 0 {
28 tmp1
.Lsh(numer
, 1).Add(tmp1
, numer
).Add(tmp1
, accum
)
29 big
.DivModInt(tmp1
, tmp2
, tmp1
, denom
)
31 if big
.CmpInt(tmp2
, denom
) >= 0 {
37 func nextTerm(k
int64) {
39 accum
.Add(accum
, tmp1
.Lsh(numer
, 1))
40 accum
.Mul(accum
, tmp1
.SetInt64(y2
))
41 numer
.Mul(numer
, tmp1
.SetInt64(k
))
42 denom
.Mul(denom
, tmp1
.SetInt64(y2
))
45 func eliminateDigit(d
int64) {
46 accum
.Sub(accum
, tmp1
.Mul(denom
, tmp1
.SetInt64(d
)))
62 fmt
.Printf("%c", d
+'0')
72 fmt
.Printf("\n%d calls; bit sizes: %d %d %d\n", runtime
.NumCgoCall(), numer
.Len(), accum
.Len(), denom
.Len())