Skip to content

Commit

Permalink
export exp2
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Dec 14, 2022
1 parent f442bce commit 025feb0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions osmomath/exp2.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ var (
maxSupportedExponent = MustNewDecFromStr("2").PowerInteger(9)
)

// exp2 takes 2 to the power of a given non-negative decimal exponent.
// Exp2 takes 2 to the power of a given non-negative decimal exponent.
// and returns the result.
// The computation is performed by using th following property:
// 2^decimal_exp = 2^{integer_exp + fractional_exp} = 2^integer_exp * 2^fractional_exp
// The max supported exponent is 2^10. If greater exponent is given, the function panics.
// Panics if the exponent is negative.
func exp2(exponent BigDec) BigDec {
func Exp2(exponent BigDec) BigDec {
if exponent.Abs().GT(maxSupportedExponent) {
panic(fmt.Sprintf("integer exponent %s is too large, max (%s)", exponent, maxSupportedExponent))
}
Expand Down
4 changes: 0 additions & 4 deletions osmomath/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ var (
MaxSupportedExponent = maxSupportedExponent
)

func Exp2(exponent BigDec) BigDec {
return exp2(exponent)
}

func Exp2ChebyshevRationalApprox(exponent BigDec) BigDec {
return exp2ChebyshevRationalApprox(exponent)
}

0 comments on commit 025feb0

Please sign in to comment.