Skip to content

Commit

Permalink
Clarify ApproxExpBasisPoints degree parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower committed Jul 31, 2024
1 parent ac2603a commit 3e4ef9a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions util/arbmath/math.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func DivCeil[T Unsigned](value, divisor T) T {

// ApproxExpBasisPoints return the Maclaurin series approximation of e^x, where x is denominated in basis points.
// The quartic polynomial will underestimate e^x by about 5% as x approaches 20000 bips.
func ApproxExpBasisPoints(value Bips, degree uint64) Bips {
func ApproxExpBasisPoints(value Bips, accuracy uint64) Bips {
input := value
negative := value < 0
if negative {
Expand All @@ -396,9 +396,9 @@ func ApproxExpBasisPoints(value Bips, degree uint64) Bips {
x := uint64(input)
bips := uint64(OneInBips)

res := bips + x/degree
for i := uint64(1); i < degree; i++ {
res = bips + SaturatingUMul(res, x)/((degree-i)*bips)
res := bips + x/accuracy
for i := uint64(1); i < accuracy; i++ {
res = bips + SaturatingUMul(res, x)/((accuracy-i)*bips)
}

if negative {
Expand Down

0 comments on commit 3e4ef9a

Please sign in to comment.