Class BinaryRelations

java.lang.Object
org.mariuszgromada.math.mxparser.mathcollection.BinaryRelations

public final class BinaryRelations extends Object
BinaryRelations - class for dealing with binary relations on integers or doubles.
Version:
5.2.0
Author:
Mariusz Gromada
MathParser.org - mXparser project page
mXparser on GitHub
INFIMA place to purchase a commercial MathParser.org-mXparser software license
info@mathparser.org
ScalarMath.org - a powerful math engine and math scripting language
Scalar Lite
Scalar Pro
MathSpace.pl
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    Default epsilon for comparison
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Checks if epsilon comparison mode is active;
    static boolean
    Checks if exact comparison mode is active;
    static double
    eq(double a, double b)
    Equality relation.
    static double
    geq(double a, double b)
    Greater or equal relation.
    static double
    Returns current epsilon value.
    static double
    gt(double a, double b)
    Greater than relation.
    static boolean
    isEqualOrAlmost(double a, double b)
    Test for equality or almost equality.
    static double
    leq(double a, double b)
    Lower or equal relation.
    static double
    lt(double a, double b)
    Lower than relation.
    static double
    neq(double a, double b)
    Inequality relation.
    static void
    Sets default epsilon value.
    static void
    setEpsilon(double epsilon)
    Sets epsilon value.
    static void
    Sets comparison mode to EPSILON.
    static void
    Sets comparison mode to EXACT.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_COMPARISON_EPSILON

      public static final double DEFAULT_COMPARISON_EPSILON
      Default epsilon for comparison
      See Also:
  • Constructor Details

    • BinaryRelations

      public BinaryRelations()
  • Method Details

    • setExactComparison

      public static void setExactComparison()
      Sets comparison mode to EXACT.
    • setEpsilonComparison

      public static void setEpsilonComparison()
      Sets comparison mode to EPSILON.
    • setEpsilon

      public static void setEpsilon(double epsilon)
      Sets epsilon value.
      Parameters:
      epsilon - Epsilon value (grater than 0).
      See Also:
    • setDefaultEpsilon

      public static void setDefaultEpsilon()
      Sets default epsilon value.
      See Also:
    • getEpsilon

      public static double getEpsilon()
      Returns current epsilon value.
      Returns:
      Returns current epsilon value.
      See Also:
    • checkIfEpsilonMode

      public static boolean checkIfEpsilonMode()
      Checks if epsilon comparison mode is active;
      Returns:
      True if epsilon mode is active, otherwise returns false.
      See Also:
    • checkIfExactMode

      public static boolean checkIfExactMode()
      Checks if exact comparison mode is active;
      Returns:
      True if exact mode is active, otherwise returns false.
      See Also:
    • eq

      public static double eq(double a, double b)
      Equality relation.
      Parameters:
      a - the a number (a = b)
      b - the b number (a = b)
      Returns:
      if a = Double.NaN or b = Double.NaN return Double.NaN, else if a = b return 1, otherwise return 0.
    • isEqualOrAlmost

      public static boolean isEqualOrAlmost(double a, double b)
      Test for equality or almost equality.
      Parameters:
      a - First number
      b - Second number
      Returns:
      Returns true if both number are equal or are almost equal.
      See Also:
    • neq

      public static double neq(double a, double b)
      Inequality relation.
      Parameters:
      a - the a number (a <> b)
      b - the b number (a <> b)
      Returns:
      if a = Double.NaN or b = Double.NaN return Double.NaN, else if a <> b return 1, otherwise return 0.
    • lt

      public static double lt(double a, double b)
      Lower than relation.
      Parameters:
      a - the a number (a < b)
      b - the b number (a < b)
      Returns:
      if a = Double.NaN or b = Double.NaN return Double.NaN, else if a < b return 1, otherwise return 0.
    • gt

      public static double gt(double a, double b)
      Greater than relation.
      Parameters:
      a - the a number (a > b)
      b - the b number (a > b)
      Returns:
      if a = Double.NaN or b = Double.NaN return Double.NaN, else if a > b return 1, otherwise return 0.
    • leq

      public static double leq(double a, double b)
      Lower or equal relation.
      Parameters:
      a - the a number (a <= b)
      b - the b number (a <= b)
      Returns:
      if a = Double.NaN or b = Double.NaN return Double.NaN, else if a <= b return 1, otherwise return 0.
    • geq

      public static double geq(double a, double b)
      Greater or equal relation.
      Parameters:
      a - the a number (a >= b)
      b - the b number (a >= b)
      Returns:
      if a = Double.NaN or b = Double.NaN return Double.NaN, else if a >= b return 1, otherwise return 0.