reorganize function

This commit is contained in:
filifa 2025-09-06 00:13:30 -04:00
parent 67c95db7ba
commit b953ade1a1
1 changed files with 6 additions and 7 deletions

View File

@ -58,12 +58,12 @@ func gaussianBrackets(ch <-chan *big.Int) <-chan *big.Int {
}
func cFracConvergents(a0 *big.Int, denoms []*big.Int) <-chan *big.Rat {
f := cycle(denoms)
_ = <-f
g := cycle(denoms)
hc := cycle(denoms)
_ = <-hc
hch := gaussianBrackets(hc)
hch := gaussianBrackets(f)
kch := gaussianBrackets(g)
kc := cycle(denoms)
kch := gaussianBrackets(kc)
_ = <-kch
a := new(big.Rat).SetInt(a0)
@ -72,9 +72,8 @@ func cFracConvergents(a0 *big.Int, denoms []*big.Int) <-chan *big.Rat {
go func() {
for {
r := new(big.Rat)
h, k := <-hch, <-kch
r.SetFrac(h, k)
r := new(big.Rat).SetFrac(h, k)
r.Add(r, a)
out <- r
}