Expr

sealed abstract
class Expr extends Serializable

The Algebraic expression AST. Algebraic simply stores an expression tree representing all operations performed on it. We then use this tree to deduce certain properties about the algebraic expression and use them to perform exact sign tests, compute approximations, etc.

Generally, this should be regarded as an internal implementation detail of Algebraic.

Companion
object
trait Serializable
class Object
trait Matchable
class Any
class Add
class Sub
class Div
class Mul
class Constant[A]
class UnaryExpr
class KRoot
class Neg
class Pow

Value members

Abstract methods

def children: List[Expr]

Returns a list of the children of this expression. A child is a sub-expression required by this expression. For instance, Add has 2 children, the left-hand and right-hand side sub-expressions. A numeric literal expression, such as ConstantDouble or ConstantRational has no children.

Returns a list of the children of this expression. A child is a sub-expression required by this expression. For instance, Add has 2 children, the left-hand and right-hand side sub-expressions. A numeric literal expression, such as ConstantDouble or ConstantRational has no children.

def signum: Int

Returns an integer with the same sign as this expression.

Returns an integer with the same sign as this expression.

def toBigDecimal(digits: Int): BigDecimal

Returns an asbolute approximation to this expression as a BigDecimal that is accurate up to +/- 10^-digits.

Returns an asbolute approximation to this expression as a BigDecimal that is accurate up to +/- 10^-digits.

Returns an upper bound on the absolute value of this expression as a bit bound.

Returns an upper bound on the absolute value of this expression as a bit bound.

Concrete methods

Returns the BFMSS separation bound.

Returns the BFMSS separation bound.

def degreeBound: Long

Returns a bound on the degree of this expression.

Returns a bound on the degree of this expression.

A set of flags we can quickly compute for an Algebraic expression.

A set of flags we can quickly compute for an Algebraic expression.

Note

we have to do this round-about trip between flagsBits and flags because of

Returns the bound for zbf, using a cached value if it is available.

Returns the bound for zbf, using a cached value if it is available.

Returns the Li & Yap separation bound.

Returns the Li & Yap separation bound.

Returns a lower bound on the absolute value of this expression as a bit bound.

Returns a lower bound on the absolute value of this expression as a bit bound.

TODO: We could do better here wrt to addition (need a fastSignum: Option[Int])

Returns a separation bound for this expression as a bit bound. A separation bound is a lower-bound on the value of this expression that is only valid if this expression is not 0. This bound can thus be used to determine if this value is actually 0 and, if not, the sign, by simply approximating the expression with enough accuracy that it falls on one side or the other of the separation bound.

Returns a separation bound for this expression as a bit bound. A separation bound is a lower-bound on the value of this expression that is only valid if this expression is not 0. This bound can thus be used to determine if this value is actually 0 and, if not, the sign, by simply approximating the expression with enough accuracy that it falls on one side or the other of the separation bound.