aherbert commented on a change in pull request #92:
URL: https://github.com/apache/commons-numbers/pull/92#discussion_r646450868



##########
File path: 
commons-numbers-arrays/src/test/java/org/apache/commons/numbers/arrays/ExtendedPrecisionTest.java
##########
@@ -102,6 +102,23 @@ void testSubNormalSplit() {
         final double lo2 = a - hi2;
         Assertions.assertEquals(a, hi2);
         Assertions.assertEquals(0, lo2);
+
+
         Assertions.assertTrue(Math.abs(hi2) > Math.abs(lo2));
     }
+
+    @Test
+    void testSquareLowUnscaled() {
+        assertSquareLowUnscaled(0.0, 1.0);
+        assertSquareLowUnscaled(0.0, -1.0);
+        assertSquareLowUnscaled(-1.4293872661474477E-16, Math.PI);

Review comment:
       Since the code is on Java 9 for testing you can drop BigDecimal and 
simplify this to:
   ```java
   assertSquareLowUnscaled(Math.fma(Math.PI, Math.PI, -Math.PI * Math.PI), 
Math.PI);
   ```
   
   

##########
File path: 
commons-numbers-arrays/src/main/java/org/apache/commons/numbers/arrays/ExtendedPrecision.java
##########
@@ -204,6 +204,28 @@ private static double productLowUnscaled(double x, double 
y, double xy) {
         return productLow(hx, lx, hy, ly, xy);
     }
 
+    /**
+     * Compute the low part of the double length number {@code (z,zz)} for the 
exact
+     * square of {@code x} using Dekker's mult12 algorithm. The standard 
precision product
+     * {@code x*x} must be provided. The number {@code x} is split into high 
and low parts
+     * using Dekker's algorithm.
+     *
+     * <p>Warning: This method does not perform scaling in Dekker's split and 
large
+     * finite numbers can create NaN results.
+     *
+     * @param x Number to square
+     * @param xx Standard precision product {@code x*x)

Review comment:
       Javadoc issue: This should have a `}` not a `)`.

##########
File path: 
commons-numbers-arrays/src/main/java/org/apache/commons/numbers/arrays/ExtendedPrecision.java
##########
@@ -204,6 +204,28 @@ private static double productLowUnscaled(double x, double 
y, double xy) {
         return productLow(hx, lx, hy, ly, xy);
     }
 
+    /**
+     * Compute the low part of the double length number {@code (z,zz)} for the 
exact
+     * square of {@code x} using Dekker's mult12 algorithm. The standard 
precision product
+     * {@code x*x} must be provided. The number {@code x} is split into high 
and low parts
+     * using Dekker's algorithm.
+     *
+     * <p>Warning: This method does not perform scaling in Dekker's split and 
large
+     * finite numbers can create NaN results.
+     *
+     * @param x Number to square
+     * @param xx Standard precision product {@code x*x)
+     * @return the low part of the square double length number
+     * @see #productLowUnscaled(double, double, double)

Review comment:
       Javadoc issue: The productLowUnscaled is private. So you cannot refer to 
it in a package private method.




-- 
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.

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


Reply via email to