massively improve performance with dynamic programming
This commit is contained in:
@@ -19,6 +19,7 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
"strconv"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"scm.dairydemon.net/filifa/mathtools/internal/lib"
|
||||
@@ -31,13 +32,13 @@ var stirlingBottom string
|
||||
var stirlingUnsigned bool
|
||||
|
||||
func stirling(cmd *cobra.Command, args []string) {
|
||||
n, ok := new(big.Int).SetString(stirlingTop, 10)
|
||||
if !ok {
|
||||
n, err := strconv.Atoi(stirlingTop)
|
||||
if err != nil {
|
||||
cobra.CheckErr("invalid input " + stirlingTop)
|
||||
}
|
||||
|
||||
k, ok := new(big.Int).SetString(stirlingBottom, 10)
|
||||
if !ok {
|
||||
k, err := strconv.Atoi(stirlingBottom)
|
||||
if err != nil {
|
||||
cobra.CheckErr("invalid input " + stirlingBottom)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user