exp

package
v0.0.0-...-7188496 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Add

type Add struct {
	L Exp
	R Exp
}

Add represents an addition operation

func (Add) Eval

func (a Add) Eval() float64

Eval returns the value of an Add

func (Add) String

func (a Add) String() string

String returns the string representation of an Add

type Div

type Div struct {
	L Exp
	R Exp
}

Div represents a division operation

func (Div) Eval

func (d Div) Eval() float64

Eval returns the value of a Div

func (Div) String

func (d Div) String() string

String returns the string representation of a Div

type Exp

type Exp interface {
	Eval() float64
	String() string
}

Exp describes a mathematical expression

type Mod

type Mod struct {
	L Exp
	R Exp
}

Mod represents a modulus operation

func (Mod) Eval

func (m Mod) Eval() float64

Eval returns the value of a Mod

func (Mod) String

func (m Mod) String() string

String returns the string representation of a Mod

type Mul

type Mul struct {
	L Exp
	R Exp
}

Mul represents a multiplication operation

func (Mul) Eval

func (m Mul) Eval() float64

Eval returns the value of a Mul

func (Mul) String

func (m Mul) String() string

String returns the string representation of a Mul

type Num

type Num struct {
	Val float64
}

Num represent a constant number

func (Num) Eval

func (n Num) Eval() float64

Eval returns the value of a Num

func (Num) String

func (n Num) String() string

String returns the string representation of a Num

type Pow

type Pow struct {
	L Exp
	R Exp
}

Pow represents an exponential operation

func (Pow) Eval

func (p Pow) Eval() float64

Eval returns the value of a Pow

func (Pow) String

func (p Pow) String() string

String returns the string representation of a Pow

type Rad

type Rad struct {
	L Exp
	R Exp
}

Rad represents a radical operation

func (Rad) Eval

func (r Rad) Eval() float64

Eval returns the value of a Rad

func (Rad) String

func (r Rad) String() string

String returns the string representation of a Div

type Sub

type Sub struct {
	L Exp
	R Exp
}

Sub represents a subtraction operation

func (Sub) Eval

func (s Sub) Eval() float64

Eval returns the value of a Sub

func (Sub) String

func (s Sub) String() string

String returns the string representation of a Sub

Jump to

Keyboard shortcuts

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