Hello,

This message is about some methods in Precision class, and follows a discussion 
about MATH-863 (https://issues.apache.org/jira/browse/MATH-863).

Recently, we slightly modified our Precision class, by adding a specific 
epsilon value to compute a relative deviation and also some methods.
---
    /** Epsilon used for doubles relative comparison */
    public static final double DOUBLE_COMPARISON_EPSILON = 1.0e-14;
---

This value is quite useful to compare two values. It's approximatively 100 
times larger than the previous EPSILON value (1e-16, the difference between 1. 
and the next closest value).

We also added static methods, to compute a relative difference : if x1 and x2 
are not equal (according to the equals(x1,x2, "1 ulp") function), then we 
compute a relative deviation ("abs(x1-x2)/max(abs(x1),abs(x2))" and see if it's 
lower than an epsilon value.

---
    public static boolean equalsWithRelativeTolerance(final double x, final 
double y) -> uses the DOUBLE_COMPARISON_EPSILON
    public static boolean equalsWithRelativeTolerance(final double x, final 
double y, final double eps)
---

These kind of methods are used in some of our tools (space dynamic libraries) 
to assert equality between values, when we don't know the order of magnitude.

Do you think it's useful for Commons Math users ?
Shall I open a ticket on JIRA and contribute the corresponding code source ?

Best regards,

Yannick TANGUY

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to