number

package
v1.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Grammar = `` /* 236-byte string literal not displayed */

-----------------------------------------------------------------------------

Variables

View Source
var (
	ErrUnsupportedRetType = errors.New("unsupported return type of function")
	ErrFncallWithoutArity = errors.New("function call without arity")
)
View Source
var Fntable = map[string]interface{}{
	"abs":       math.Abs,
	"acos":      math.Acos,
	"acosh":     math.Acosh,
	"asin":      math.Asin,
	"asinh":     math.Asinh,
	"atan":      math.Atan,
	"atan2":     math.Atan2,
	"atanh":     math.Atanh,
	"cbrt":      math.Cbrt,
	"ceil":      math.Ceil,
	"copysign":  math.Copysign,
	"cos":       math.Cos,
	"cosh":      math.Cosh,
	"dim":       math.Dim,
	"erf":       math.Erf,
	"erfc":      math.Erfc,
	"exp":       math.Exp,
	"exp2":      math.Exp2,
	"expm1":     math.Expm1,
	"floor":     math.Floor,
	"gamma":     math.Gamma,
	"hypot":     math.Hypot,
	"inf":       Inf,
	"j0":        math.J0,
	"j1":        math.J1,
	"jn":        Jn,
	"ldexp":     Ldexp,
	"ln":        math.Log,
	"log":       math.Log,
	"log10":     math.Log10,
	"log1p":     math.Log1p,
	"log2":      math.Log2,
	"logb":      math.Logb,
	"max":       Max,
	"min":       Min,
	"mod":       math.Mod,
	"NaN":       math.NaN,
	"nextafter": math.Nextafter,
	"pow":       math.Pow,
	"pow10":     Pow10,
	"remainder": math.Remainder,
	"sin":       math.Sin,
	"sinh":      math.Sinh,
	"sqrt":      math.Sqrt,
	"tan":       math.Tan,
	"tanh":      math.Tanh,
	"trunc":     math.Trunc,
	"y0":        math.Y0,
	"y1":        math.Y1,
	"yn":        Yn,

	"$neg":   Neg,
	"$mul":   Mul,
	"$quo":   Quo,
	"$mod":   math.Mod,
	"$add":   Add,
	"$sub":   Sub,
	"$ARITY": Arity,
	"$push":  (*Stack).Push,
	"$ident": (*Stack).PushIdent,
	"$call":  (*Calculator).Call,
}

Functions

func Add

func Add(a, b float64) float64

func Arity

func Arity(stk *Stack, arity int)

func Inf

func Inf(a float64) float64

func Jn

func Jn(a, b float64) float64

func Ldexp

func Ldexp(a, b float64) float64

func Max

func Max(args ...float64) (max float64)

func Min

func Min(args ...float64) (min float64)

func Mul

func Mul(a, b float64) float64

func Neg

func Neg(a float64) float64

func Pow10

func Pow10(a float64) float64

func Quo

func Quo(a, b float64) float64

func Sub

func Sub(a, b float64) float64

func Yn

func Yn(a, b float64) float64

Types

type Calculator

type Calculator struct {
	// contains filtered or unexported fields
}

func New

func New() *Calculator

func (*Calculator) Call

func (p *Calculator) Call(name string) error

func (*Calculator) Fntable

func (p *Calculator) Fntable() map[string]interface{}

func (*Calculator) Grammar

func (p *Calculator) Grammar() string

func (*Calculator) Ret

func (p *Calculator) Ret() (v float64, ok bool)

func (*Calculator) Stack

func (p *Calculator) Stack() interpreter.Stack

type Stack

type Stack []float64

func NewStack

func NewStack() *Stack

func (*Stack) Clear

func (stk *Stack) Clear()

func (*Stack) Pop

func (stk *Stack) Pop() (v float64, ok bool)

func (*Stack) PopArgs

func (stk *Stack) PopArgs(arity int) (args []reflect.Value, ok bool)

func (*Stack) Push

func (stk *Stack) Push(v float64)

func (*Stack) PushIdent

func (stk *Stack) PushIdent(v string)

func (*Stack) PushRet

func (stk *Stack) PushRet(ret []reflect.Value) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL