cmplx

package
v0.0.0-...-e5fbc35 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Grammar = `` /* 218-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":   Abs,
	"acos":  cmplx.Acos,
	"acosh": cmplx.Acosh,
	"asin":  cmplx.Asin,
	"asinh": cmplx.Asinh,
	"atan":  cmplx.Atan,
	"atanh": cmplx.Atanh,
	"conj":  cmplx.Conj,
	"cos":   cmplx.Cos,
	"cosh":  cmplx.Cosh,
	"cot":   cmplx.Cot,
	"exp":   cmplx.Exp,
	"inf":   cmplx.Inf,
	"log":   cmplx.Log,
	"log10": cmplx.Log10,
	"NaN":   cmplx.NaN,
	"phase": Phase,
	"pow":   cmplx.Pow,
	"rect":  Rect,
	"sin":   cmplx.Sin,
	"sinh":  cmplx.Sinh,
	"sqrt":  cmplx.Sqrt,
	"tan":   cmplx.Tan,
	"tanh":  cmplx.Tanh,

	"real":    Real,
	"imag":    Imag,
	"complex": Complex,

	"$neg":   Neg,
	"$mul":   Mul,
	"$quo":   Quo,
	"$add":   Add,
	"$sub":   Sub,
	"$ARITY": Arity,
	"$push":  (*Stack).PushReal,
	"$pushi": (*Stack).PushImag,
	"$call":  (*Calculator).Call,
}

Functions

func Abs

func Abs(a complex128) complex128

func Add

func Add(a, b complex128) complex128

func Arity

func Arity(stk *Stack, arity int)

func Complex

func Complex(a, b complex128) complex128

func Imag

func Imag(a complex128) complex128

func Mul

func Mul(a, b complex128) complex128

func Neg

func Neg(a complex128) complex128

func Phase

func Phase(a complex128) complex128

func Quo

func Quo(a, b complex128) complex128

func Real

func Real(a complex128) complex128

func Rect

func Rect(a, b complex128) complex128

func Sub

func Sub(a, b complex128) complex128

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 complex128, ok bool)

func (*Calculator) Stack

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

type Stack

type Stack []complex128

func NewStack

func NewStack() *Stack

func (*Stack) Clear

func (stk *Stack) Clear()

func (*Stack) Pop

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

func (*Stack) PopArgs

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

func (*Stack) Push

func (stk *Stack) Push(v complex128)

func (*Stack) PushImag

func (stk *Stack) PushImag(v string)

func (*Stack) PushReal

func (stk *Stack) PushReal(v float64)

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