Class ErfDifference

java.lang.Object
org.apache.commons.numbers.gamma.ErfDifference

public final class ErfDifference extends Object
Computes the difference between error function values.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final double
    This number solves erf(x) = 0.5 within 1 ulp.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Private constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    value(double x1, double x2)
    The implementation uses either Erf or Erfc, depending on which provides the most precise result.

    Methods inherited from class java.lang.Object

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

    • X_CRIT

      private static final double X_CRIT
      This number solves erf(x) = 0.5 within 1 ulp. More precisely, the current implementations of Erf.value(double) and Erfc.value(double) satisfy:
      • Erf.value(X_CRIT) == 0.5,
      • Erf.value(Math.nextUp(X_CRIT)) > 0.5,
      • Erfc.value(X_CRIT) == 0.5, and
      • Erfc.value(Math.nextUp(X_CRIT)) < 0.5
      See Also:
  • Constructor Details

    • ErfDifference

      private ErfDifference()
      Private constructor.
  • Method Details

    • value

      public static double value(double x1, double x2)
      The implementation uses either Erf or Erfc, depending on which provides the most precise result.
      Parameters:
      x1 - First value.
      x2 - Second value.
      Returns:
      Erf.value(x2) - Erf.value(x1).
      Throws:
      ArithmeticException - if the algorithm fails to converge.