Class MBMath

All Implemented Interfaces:
Expression, Function

public class MBMath extends MBExpression
  • Constructor Details

    • MBMath

      public MBMath(JSONArray json)
  • Method Details

    • mathSubtract

      public Expression mathSubtract()
      For two inputs, returns the result of subtracting the second input from the first. For a single input, returns the result of subtracting it from 0. Example: ["-", number, number]: number ["-", number]: number
      Returns:
      subtract expression
    • mathMultiply

      public Expression mathMultiply()
      Returns the product of the inputs. Example: ["*", number, number, ...]: number
      Returns:
      multiply expression
    • mathDivide

      public Expression mathDivide()
      Returns the result of floating point division of the first input by the second. Example: ["/", number, number]: number
      Returns:
      divide expression
    • mathRemainder

      public Expression mathRemainder()
      Returns the remainder after integer division of the first input by the second. Example: ["%", number, number]: number
      Returns:
      remainder expression
    • mathExponent

      public Expression mathExponent()
      Returns the result of raising the first input to the power specified by the second. Example: ["^", number, number]: number
      Returns:
      exponent expression
    • mathAdd

      public Expression mathAdd()
      Returns the sum of the inputs. Example: ["+", number, number...]: number
      Returns:
      add expression
    • mathAcos

      public Expression mathAcos()
      Returns the arccosine of the input. Example: ["acos", number]: number
      Returns:
      acos expression
    • mathAsin

      public Expression mathAsin()
      Returns the arcsine of the input. Example: ["asin", number]: number
      Returns:
      asin expression
    • mathAtan

      public Expression mathAtan()
      Returns the arctangent of the input. Example: ["atan", number]: number
      Returns:
      atan expression
    • mathCos

      public Expression mathCos()
      Returns the cosine of the input. Example: ["cos", number]: number
      Returns:
      cos expression
    • mathE

      public Expression mathE()
      Returns the mathematical constant e. Example: ["e"]: number
      Returns:
      constant e literal
    • mathLn

      public Expression mathLn()
      Returns the natural logarithm of the input. Example: ["ln", number]: number
      Returns:
      log expression
    • mathLn2

      public Expression mathLn2()
      Returns mathematical constant ln(2). Example: ["ln2"]: number
      Returns:
      min(2) as a literal
    • mathLog10

      public Expression mathLog10()
      Returns the base-ten logarithm of the input. Example: ["log10", number]: number
      Returns:
      log10 expression
    • mathLog2

      public Expression mathLog2()
      Returns the base-two logarithm of the input. Example: ["log2", number]: number
      Returns:
      base to log expression
    • mathMax

      public Expression mathMax()
      Returns the maximum value of the inputs. Example: ["max", number, number, ...]: number
      Returns:
      max expression
    • mathMin

      public Expression mathMin()
      Returns the minimum value of the inputs. Example: ["min", number, number, ...]: number
      Returns:
      min expression
    • mathPi

      public Expression mathPi()
      Returns the mathematical constant pi. Example: ["pi"]: number
      Returns:
      pi literal
    • mathSin

      public Expression mathSin()
      Returns the sine of the input. Example: ["sin", number]: number
      Returns:
      sin expression
    • mathSqrt

      public Expression mathSqrt()
      Returns the square root of the input. Example: ["sqrt", number]: number
      Returns:
      sqrt expression
    • mathTan

      public Expression mathTan()
      Returns the tangent of the input. Example: ["tan", number]: number
      Returns:
      tan expression
    • getExpression

      public Expression getExpression() throws MBFormatException
      Description copied from class: MBExpression
      Determines which expression to use.
      Specified by:
      getExpression in class MBExpression
      Throws:
      MBFormatException