Documentation
¶
Overview ¶
Package numbers implement elements representing numbers for the interpreter.
Index ¶
- type Float
- func (n *Float) BinaryOp(ctx ir.Evaluator, expr *ir.BinaryExpr, x, y evaluator.NumericalElement) (evaluator.NumericalElement, error)
- func (n *Float) CanonicalExpr() canonical.Canonical
- func (n *Float) Cast(ctx ir.Evaluator, expr ir.AssignableExpr, target ir.Type) (evaluator.NumericalElement, error)
- func (n *Float) Compare(x canonical.Comparable) bool
- func (n *Float) Float() *big.Float
- func (n *Float) Reshape(ctx ir.Evaluator, expr ir.AssignableExpr, ...) (evaluator.NumericalElement, error)
- func (n *Float) Shape() *shape.Shape
- func (n *Float) Simplify() canonical.Simplifier
- func (n *Float) String() string
- func (n *Float) Type() ir.Type
- func (n *Float) UnaryOp(ctx ir.Evaluator, expr *ir.UnaryExpr) (evaluator.NumericalElement, error)
- type Int
- func (n *Int) BinaryOp(ctx ir.Evaluator, expr *ir.BinaryExpr, x, y evaluator.NumericalElement) (evaluator.NumericalElement, error)
- func (n *Int) CanonicalExpr() canonical.Canonical
- func (n *Int) Cast(ctx ir.Evaluator, expr ir.AssignableExpr, target ir.Type) (evaluator.NumericalElement, error)
- func (n *Int) Compare(x canonical.Comparable) bool
- func (n *Int) Float() *big.Float
- func (n *Int) Reshape(ctx ir.Evaluator, expr ir.AssignableExpr, ...) (evaluator.NumericalElement, error)
- func (n *Int) Shape() *shape.Shape
- func (n *Int) String() string
- func (n *Int) Type() ir.Type
- func (n *Int) UnaryOp(ctx ir.Evaluator, expr *ir.UnaryExpr) (evaluator.NumericalElement, error)
- type Number
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
Float is a GX number.
func (*Float) BinaryOp ¶
func (n *Float) BinaryOp(ctx ir.Evaluator, expr *ir.BinaryExpr, x, y evaluator.NumericalElement) (evaluator.NumericalElement, error)
BinaryOp applies a binary operator to x and y. Note that the receiver can be either the left or right argument.
func (*Float) CanonicalExpr ¶
CanonicalExpr returns the canonical expression used for comparison.
func (*Float) Cast ¶
func (n *Float) Cast(ctx ir.Evaluator, expr ir.AssignableExpr, target ir.Type) (evaluator.NumericalElement, error)
Cast an element into a given data type.
func (*Float) Compare ¶
func (n *Float) Compare(x canonical.Comparable) bool
Compare with another number.
func (*Float) Reshape ¶
func (n *Float) Reshape(ctx ir.Evaluator, expr ir.AssignableExpr, axisLengths []evaluator.NumericalElement) (evaluator.NumericalElement, error)
Reshape the number into an array.
func (*Float) Simplify ¶
func (n *Float) Simplify() canonical.Simplifier
Simplify returns the expression simplified.
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
Int is a GX number.
func (*Int) BinaryOp ¶
func (n *Int) BinaryOp(ctx ir.Evaluator, expr *ir.BinaryExpr, x, y evaluator.NumericalElement) (evaluator.NumericalElement, error)
BinaryOp applies a binary operator to x and y. Note that the receiver can be either the left or right argument.
func (*Int) CanonicalExpr ¶
CanonicalExpr returns the canonical expression used for comparison.
func (*Int) Cast ¶
func (n *Int) Cast(ctx ir.Evaluator, expr ir.AssignableExpr, target ir.Type) (evaluator.NumericalElement, error)
Cast an element into a given data type.
func (*Int) Compare ¶
func (n *Int) Compare(x canonical.Comparable) bool
Compare with another number.
func (*Int) Reshape ¶
func (n *Int) Reshape(ctx ir.Evaluator, expr ir.AssignableExpr, axisLengths []evaluator.NumericalElement) (evaluator.NumericalElement, error)
Reshape the number into an array.