The bigfloat.Pow() function seems a little too restrictive relative to the math.Pow() standard library equivalent for negative bases with integer exponents (which are well-defined).
Thanks!
package main
import (
"fmt"
"math"
"math/big"
"github.com/ALTree/bigfloat"
)
func main() {
// Exponentiation of all negative bases is well defined for all
// integer valued exponents. e.g. -2^-2 = 0.25
quarter := math.Pow(-2, -2)
fmt.Printf("%f\n", quarter) // 0.250000
bigneg2 := big.NewFloat(-2)
bigquarter := bigfloat.Pow(bigneg2, bigneg2) // PANIC! Pow: negative base
fmt.Printf("%f\n", bigquarter)
}
Hi, Thanks for this great little package!
The
bigfloat.Pow()
function seems a little too restrictive relative to themath.Pow()
standard library equivalent for negative bases with integer exponents (which are well-defined).Thanks!