reorganize loop
This commit is contained in:
parent
cafef6a4a2
commit
67c95db7ba
|
|
@ -42,13 +42,15 @@ func gaussianBrackets(ch <-chan *big.Int) <-chan *big.Int {
|
|||
x := big.NewInt(1)
|
||||
|
||||
go func() {
|
||||
out <- big.NewInt(1)
|
||||
tmp := new(big.Int)
|
||||
for a := range ch {
|
||||
tmp := new(big.Int).Mul(a, x)
|
||||
out <- x
|
||||
|
||||
tmp.Mul(a, x)
|
||||
tmp.Add(tmp, xprev)
|
||||
|
||||
xprev.Set(x)
|
||||
x.Set(tmp)
|
||||
out <- tmp
|
||||
x = new(big.Int).Set(tmp)
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue