本文整理了Java中org.apache.commons.math3.util.Precision.equalsWithRelativeTolerance()
方法的一些代码示例,展示了Precision.equalsWithRelativeTolerance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Precision.equalsWithRelativeTolerance()
方法的具体详情如下:
包路径:org.apache.commons.math3.util.Precision
类名称:Precision
方法名:equalsWithRelativeTolerance
[英]Returns true if there is no double value strictly between the arguments or the relative difference between them is less than or equal to the given tolerance. Returns false if either of the arguments is NaN.
[中]如果参数之间没有严格意义上的双精度值,或者它们之间的相对差值小于或等于给定的公差,则返回true。如果其中一个参数为NaN,则返回false。
代码示例来源:origin: org.apache.commons/commons-math3
/**
* Returns {@code true} if, both for the real part and for the imaginary
* part, there is no double value strictly between the arguments or the
* relative difference between them is smaller or equal to the given
* tolerance. Returns {@code false} if either of the arguments is NaN.
*
* @param x First value (cannot be {@code null}).
* @param y Second value (cannot be {@code null}).
* @param eps Amount of allowed relative error.
* @return {@code true} if the values are two adjacent floating point
* numbers or they are within range of each other.
*
* @see Precision#equalsWithRelativeTolerance(double,double,double)
* @since 3.3
*/
public static boolean equalsWithRelativeTolerance(Complex x, Complex y,
double eps) {
return Precision.equalsWithRelativeTolerance(x.real, y.real, eps) &&
Precision.equalsWithRelativeTolerance(x.imaginary, y.imaginary, eps);
}
代码示例来源:origin: org.apache.commons/commons-math3
/** {@inheritDoc} */
public boolean converged(final int iteration,
final Evaluation previous,
final Evaluation current) {
final double prevRms = previous.getRMS();
final double currRms = current.getRMS();
return Precision.equals(prevRms, currRms, this.absTol) ||
Precision.equalsWithRelativeTolerance(prevRms, currRms, this.relTol);
}
代码示例来源:origin: geogebra/geogebra
/**
* Returns {@code true} if, both for the real part and for the imaginary
* part, there is no double value strictly between the arguments or the
* relative difference between them is smaller or equal to the given
* tolerance. Returns {@code false} if either of the arguments is NaN.
*
* @param x First value (cannot be {@code null}).
* @param y Second value (cannot be {@code null}).
* @param eps Amount of allowed relative error.
* @return {@code true} if the values are two adjacent floating point
* numbers or they are within range of each other.
*
* @see Precision#equalsWithRelativeTolerance(double,double,double)
* @since 3.3
*/
public static boolean equalsWithRelativeTolerance(Complex x, Complex y,
double eps) {
return Precision.equalsWithRelativeTolerance(x.real, y.real, eps) &&
Precision.equalsWithRelativeTolerance(x.imaginary, y.imaginary, eps);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* Returns {@code true} if, both for the real part and for the imaginary
* part, there is no double value strictly between the arguments or the
* relative difference between them is smaller or equal to the given
* tolerance. Returns {@code false} if either of the arguments is NaN.
*
* @param x First value (cannot be {@code null}).
* @param y Second value (cannot be {@code null}).
* @param eps Amount of allowed relative error.
* @return {@code true} if the values are two adjacent floating point
* numbers or they are within range of each other.
*
* @see Precision#equalsWithRelativeTolerance(double,double,double)
* @since 3.3
*/
public static boolean equalsWithRelativeTolerance(Complex x, Complex y,
double eps) {
return Precision.equalsWithRelativeTolerance(x.real, y.real, eps) &&
Precision.equalsWithRelativeTolerance(x.imaginary, y.imaginary, eps);
}
代码示例来源:origin: geogebra/geogebra
/** {@inheritDoc} */
public boolean converged(final int iteration,
final Evaluation previous,
final Evaluation current) {
final double prevRms = previous.getRMS();
final double currRms = current.getRMS();
return Precision.equals(prevRms, currRms, this.absTol) ||
Precision.equalsWithRelativeTolerance(prevRms, currRms, this.relTol);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/** {@inheritDoc} */
public boolean converged(final int iteration,
final Evaluation previous,
final Evaluation current) {
final double prevRms = previous.getRMS();
final double currRms = current.getRMS();
return Precision.equals(prevRms, currRms, this.absTol) ||
Precision.equalsWithRelativeTolerance(prevRms, currRms, this.relTol);
}
内容来源于网络,如有侵权,请联系作者删除!