Skip to content

Commit

Permalink
suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
BrendanChou committed May 17, 2024
1 parent b2fbd5e commit fe372d7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions protocol/lib/big_math.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ func BigMax(a, b *big.Int) *big.Int {

// BigRatMulPpm takes a `big.Rat` and returns the result of `input * ppm / 1_000_000`.
func BigRatMulPpm(input *big.Rat, ppm uint32) *big.Rat {
num := new(big.Int).SetUint64(uint64(ppm))
num.Mul(num, input.Num())
den := new(big.Int).SetUint64(uint64(OneMillion))
den.Mul(den, input.Denom())
num := new(big.Int).Mul(input.Num(), big.NewInt(int64(ppm)))
den := new(big.Int).Mul(input.Denom(), big.NewInt(int64(OneMillion)))
return new(big.Rat).SetFrac(num, den)
}

Expand Down

0 comments on commit fe372d7

Please sign in to comment.