HaraldKi commented on code in PR #138:
URL: https://github.com/apache/commons-numbers/pull/138#discussion_r1343751006


##########
commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Multiplication.java:
##########
@@ -44,4 +44,12 @@ public interface Multiplication<T> {
      * @return <code>this<sup>-1</sup></code>.
      */
     T reciprocal();
+
+    /**
+     * Is this the neutral element of multiplication? Implementations may want 
to
+     * employ more efficient means than calling equals on the one element.
+     *
+     * @return {@code true} if {@code this} equals the result of {@link #one}.

Review Comment:
   After the discussion about equals elsewhere, I am wondering what we really 
want to define here as the contract. I see two possibilities:
   * true if this.equals(one())
   * true if this is a representation of the neutral element of multiplication
   
   Meanwhile you changed `DD.equals(double, double)` so the two may be the same 
now for the implementations available. From a usage perspective I would clearly 
hope they are always the same, but that would pose specific requirements for 
further implementations' `equals()` methods which may need to be documented 
somewhere, n particular given the precedent of BigDecimal's `equal()` not 
providing semantic equivalence but structural equivalence.
   
   (Same discussion for `isZero()` of course.)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to