You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2016/10/25 10:22:16 UTC

svn commit: r1766500 [2/2] - in /sis/branches/JDK8/core: sis-referencing/src/main/java/org/apache/sis/referencing/cs/ sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/ sis-referencing/src/test/java/org/apache/sis/referencing/op...

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DoubleDouble.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DoubleDouble.java?rev=1766500&r1=1766499&r2=1766500&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DoubleDouble.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DoubleDouble.java [UTF-8] Tue Oct 25 10:22:16 2016
@@ -17,6 +17,7 @@
 package org.apache.sis.internal.util;
 
 import java.util.Arrays;
+import org.apache.sis.math.Fraction;
 import org.apache.sis.math.MathFunctions;
 import org.apache.sis.math.DecimalFunctions;
 // No BigDecimal dependency - see class javadoc
@@ -56,7 +57,7 @@ import org.apache.sis.math.DecimalFuncti
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.8
  * @module
  *
  * @see <a href="http://en.wikipedia.org/wiki/Double-double_%28arithmetic%29#Double-double_arithmetic">Wikipedia: Double-double arithmetic</a>
@@ -191,7 +192,7 @@ public final class DoubleDouble extends
     /**
      * Creates a new value initialized to the given value.
      *
-     * @param other The other value to copy.
+     * @param  other  the other value to copy.
      */
     public DoubleDouble(final DoubleDouble other) {
         value = other.value;
@@ -199,14 +200,33 @@ public final class DoubleDouble extends
     }
 
     /**
-     * Creates a new value initialized to the given number. If the given number is an
-     * instance of {@code DoubleDouble}, then its error term will be taken in account.
+     * Creates a new value initialized to the given number. If the given number is an instance of
+     * {@code DoubleDouble} or {@link Fraction}, then the error term will be taken in account.
      *
-     * @param otherValue The initial value.
+     * @param  otherValue  the initial value.
      */
     public DoubleDouble(final Number otherValue) {
-        value = otherValue.doubleValue();
-        error = (otherValue instanceof DoubleDouble) ? ((DoubleDouble) otherValue).error : errorForWellKnownValue(value);
+        if (otherValue instanceof Fraction) {
+            value = ((Fraction) otherValue).denominator;
+            inverseDivide(((Fraction) otherValue).numerator, 0);
+        } else {
+            value = otherValue.doubleValue();
+            error = (otherValue instanceof DoubleDouble) ? ((DoubleDouble) otherValue).error : errorForWellKnownValue(value);
+        }
+    }
+
+    /**
+     * Returns {@code true} if the given value is one of the special cases recognized by the
+     * {@link DoubleDouble(Number)} constructor. Those special cases should rarely occur, so
+     * we do not complicate the code with optimized code paths.
+     *
+     * @param  value  the value to test.
+     * @return {@code true} if it is worth to convert the given value to a {@code DoubleDouble}.
+     *
+     * @since 0.8
+     */
+    public static boolean shouldConvert(final Number value) {
+        return (value instanceof Fraction);
     }
 
     /**
@@ -216,7 +236,7 @@ public final class DoubleDouble extends
      * <b>Tip:</b> if the other value is known to be an integer or a power of 2, then invoking
      * <code>{@linkplain #DoubleDouble(double, double) DoubleDouble}(otherValue, 0)</code> is more efficient.
      *
-     * @param value The initial value.
+     * @param  value  the initial value.
      */
     public DoubleDouble(final double value) {
         this.value = value;
@@ -227,8 +247,8 @@ public final class DoubleDouble extends
      * Creates a new value initialized to the given value and error.
      * It is caller's responsibility to ensure that the (value, error) pair is normalized.
      *
-     * @param value The initial value.
-     * @param error The initial error.
+     * @param  value  the initial value.
+     * @param  error  the initial error.
      */
     public DoubleDouble(final double value, final double error) {
         this.value = value;
@@ -237,14 +257,28 @@ public final class DoubleDouble extends
     }
 
     /**
+     * Returns the given value as a {@code DoubleDouble}. This method returns the given instance
+     * directly if it can be safely casted to {@code DoubleDouble}.
+     *
+     * @param  value  the value to cast or to copy, or {@code null}.
+     * @return the value as a {@code DoubleDouble} (may be the same instance than the given argument),
+     *         or {@code null} if the given value was null.
+     *
+     * @since 0.8
+     */
+    public static DoubleDouble castOrCopy(final Number value) {
+        return (value == null || value instanceof DoubleDouble) ? (DoubleDouble) value : new DoubleDouble(value);
+    }
+
+    /**
      * Uses the given value verbatim, without inferring an error term for double-double arithmetic.
      * We use this method when the value has been computed using transcendental functions (cosine,
      * logarithm, <i>etc.</i>) in which case there is no way we can infer a meaningful error term.
      *
      * <p>We use this method both for readability and for making easier to search where such thing occur.</p>
      *
-     * @param  value The value to wrap in a {@code DoubleDouble} instance.
-     * @return A {@code DoubleDouble} containing exactly the given value, without error term.
+     * @param  value  the value to wrap in a {@code DoubleDouble} instance.
+     * @return a {@code DoubleDouble} containing exactly the given value, without error term.
      */
     public static DoubleDouble verbatim(final double value) {
         return new DoubleDouble(value, 0);
@@ -254,7 +288,7 @@ public final class DoubleDouble extends
      * Returns a new {@code DoubleDouble} instance initialized to the conversion factor
      * from radians to angular degrees.
      *
-     * @return An instance initialized to the 57.2957795130823208767981548141052 value.
+     * @return an instance initialized to the 57.2957795130823208767981548141052 value.
      */
     public static DoubleDouble createRadiansToDegrees() {
         return new DoubleDouble(57.2957795130823208767981548141052, -1.9878495670576283E-15);
@@ -264,7 +298,7 @@ public final class DoubleDouble extends
      * Returns a new {@code DoubleDouble} instance initialized to the conversion factor
      * from angular degrees to radians.
      *
-     * @return An instance initialized to the 0.01745329251994329576923690768488613 value.
+     * @return an instance initialized to the 0.01745329251994329576923690768488613 value.
      */
     public static DoubleDouble createDegreesToRadians() {
         return new DoubleDouble(0.01745329251994329576923690768488613, 2.9486522708701687E-19);
@@ -274,7 +308,7 @@ public final class DoubleDouble extends
      * Returns a new {@code DoubleDouble} instance initialized to the conversion factor
      * from arc-seconds to radians.
      *
-     * @return An instance initialized to the 0.000004848136811095359935899141023579480 value.
+     * @return an instance initialized to the 0.000004848136811095359935899141023579480 value.
      */
     public static DoubleDouble createSecondsToRadians() {
         return new DoubleDouble(0.000004848136811095359935899141023579480, 9.320078015422868E-23);
@@ -300,8 +334,8 @@ public final class DoubleDouble extends
      * the intend was to provide the "feet to metres" conversion factor and complete the double-double instance
      * accordingly.
      *
-     * @param  value The value for which to get this error.
-     * @return The error for the given value, or 0 if unknown. In the later case,
+     * @param  value  the value for which to get this error.
+     * @return the error for the given value, or 0 if unknown. In the later case,
      *         the base 2 representation of the given value is assumed to be accurate enough.
      */
     public static double errorForWellKnownValue(final double value) {
@@ -334,7 +368,7 @@ public final class DoubleDouble extends
     /**
      * Sets this {@code DoubleDouble} to the same value than the given instance.
      *
-     * @param other The instance to copy.
+     * @param  other  the instance to copy.
      */
     public void setFrom(final DoubleDouble other) {
         value = other.value;
@@ -350,9 +384,9 @@ public final class DoubleDouble extends
      *   error = array[index + errorOffset];
      * }
      *
-     * @param array        The array from which to get the value and error.
-     * @param index        Index of the value in the given array.
-     * @param errorOffset  Offset to add to {@code index} in order to get the index of the error in the given array.
+     * @param  array        the array from which to get the value and error.
+     * @param  index        index of the value in the given array.
+     * @param  errorOffset  offset to add to {@code index} in order to get the index of the error in the given array.
      */
     public void setFrom(final double[] array, final int index, final int errorOffset) {
         value = array[index];
@@ -374,8 +408,8 @@ public final class DoubleDouble extends
      *
      * <p>Source: [Hida &amp; al.] page 4 algorithm 3, itself reproduced from [Shewchuk] page 312.</p>
      *
-     * @param a The first number to add.
-     * @param b The second number to add, which must be smaller than {@code a}.
+     * @param  a  the first number to add.
+     * @param  b  the second number to add, which must be smaller than {@code a}.
      */
     public void setToQuickSum(final double a, final double b) {
         value = a + b;
@@ -388,8 +422,8 @@ public final class DoubleDouble extends
      *
      * <p>Source: [Hida &amp; al.] page 4 algorithm 4, itself reproduced from [Shewchuk] page 314.</p>
      *
-     * @param a The first number to add.
-     * @param b The second number to add.
+     * @param  a  the first number to add.
+     * @param  b  the second number to add.
      */
     public void setToSum(final double a, final double b) {
         value = a + b;
@@ -404,8 +438,8 @@ public final class DoubleDouble extends
      *
      * <p>Source: [Hida &amp; al.] page 4 algorithm 6, itself reproduced from [Shewchuk] page 326.</p>
      *
-     * @param a The first number to multiply.
-     * @param b The second number to multiply.
+     * @param  a  the first number to multiply.
+     * @param  b  the second number to multiply.
      */
     public void setToProduct(final double a, final double b) {
         value = a * b;
@@ -428,9 +462,9 @@ public final class DoubleDouble extends
      *   array[index + errorOffset] = error;
      * }
      *
-     * @param array        The array where to store the value and error.
-     * @param index        Index of the value in the given array.
-     * @param errorOffset  Offset to add to {@code index} in order to get the index of the error in the given array.
+     * @param  array        the array where to store the value and error.
+     * @param  index        index of the value in the given array.
+     * @param  errorOffset  offset to add to {@code index} in order to get the index of the error in the given array.
      */
     public void storeTo(final double[] array, final int index, final int errorOffset) {
         array[index] = value;
@@ -440,10 +474,10 @@ public final class DoubleDouble extends
     /**
      * Swaps two double-double values in the given array.
      *
-     * @param array        The array where to swap the values and errors.
-     * @param i0           Index of the first value to swap.
-     * @param i1           Index of the second value to swap.
-     * @param errorOffset  Offset to add to the indices in order to get the error indices in the given array.
+     * @param  array        the array where to swap the values and errors.
+     * @param  i0           index of the first value to swap.
+     * @param  i1           index of the second value to swap.
+     * @param  errorOffset  offset to add to the indices in order to get the error indices in the given array.
      *
      * @see org.apache.sis.util.ArraysExt#swap(double[], int, int)
      */
@@ -472,7 +506,7 @@ public final class DoubleDouble extends
      *    add(other.value, other.error);
      * }
      *
-     * @param other The other value to add to this {@code DoubleDouble}.
+     * @param  other  the other value to add to this {@code DoubleDouble}.
      */
     public void add(final DoubleDouble other) {
         add(other.value, other.error);
@@ -480,13 +514,15 @@ public final class DoubleDouble extends
 
     /**
      * Adds a {@code Number} value to this {@code DoubleDouble}. If the given number is an instance
-     * of {@code DoubleDouble}, then its error term will be taken in account.
+     * of {@code DoubleDouble} or {@link Fraction}, then the error term will be taken in account.
      *
-     * @param other The other value to add to this {@code DoubleDouble}.
+     * @param  other  the other value to add to this {@code DoubleDouble}.
      */
     public void add(final Number other) {
         if (other instanceof DoubleDouble) {
             add((DoubleDouble) other);
+        } else if (shouldConvert(other)) {
+            add(new DoubleDouble(other));
         } else {
             add(other.doubleValue());
         }
@@ -503,7 +539,7 @@ public final class DoubleDouble extends
      * <b>Tip:</b> if the other value is known to be an integer or a power of 2, then invoking
      * <code>{@linkplain #add(double, double) add}(otherValue, 0)</code> is more efficient.
      *
-     * @param otherValue The other value to add to this {@code DoubleDouble}.
+     * @param  otherValue  the other value to add to this {@code DoubleDouble}.
      */
     public void add(final double otherValue) {
         add(otherValue, errorForWellKnownValue(otherValue));
@@ -534,8 +570,8 @@ public final class DoubleDouble extends
      *   setToQuickSum(value, error);
      * }
      *
-     * @param otherValue The other value to add to this {@code DoubleDouble}.
-     * @param otherError The error of the other value to add to this {@code DoubleDouble}.
+     * @param  otherValue  the other value to add to this {@code DoubleDouble}.
+     * @param  otherError  the error of the other value to add to this {@code DoubleDouble}.
      */
     public void add(final double otherValue, final double otherError) {
         // Inline expansion of the code in above javadoc.
@@ -568,9 +604,9 @@ public final class DoubleDouble extends
      *    add(array[index], array[index + errorOffset]);
      * }
      *
-     * @param array        The array from which to get the value and error.
-     * @param index        Index of the value in the given array.
-     * @param errorOffset  Offset to add to {@code index} in order to get the index of the error in the given array.
+     * @param  array        the array from which to get the value and error.
+     * @param  index        index of the value in the given array.
+     * @param  errorOffset  offset to add to {@code index} in order to get the index of the error in the given array.
      */
     public void add(final double[] array, final int index, final int errorOffset) {
         add(array[index], array[index + errorOffset]);
@@ -584,7 +620,7 @@ public final class DoubleDouble extends
      *    subtract(other.value, other.error);
      * }
      *
-     * @param other The other value to subtract from this value.
+     * @param  other  the other value to subtract from this value.
      */
     public void subtract(final DoubleDouble other) {
         subtract(other.value, other.error);
@@ -592,13 +628,15 @@ public final class DoubleDouble extends
 
     /**
      * Subtracts a {@code Number} from this {@code DoubleDouble}. If the given number is an instance
-     * of {@code DoubleDouble}, then its error term will be taken in account.
+     * of {@code DoubleDouble} or {@link Fraction}, then the error term will be taken in account.
      *
-     * @param other The other value to subtract from this {@code DoubleDouble}.
+     * @param  other  the other value to subtract from this {@code DoubleDouble}.
      */
     public void subtract(final Number other) {
         if (other instanceof DoubleDouble) {
             subtract((DoubleDouble) other);
+        } else if (shouldConvert(other)) {
+            subtract(new DoubleDouble(other));
         } else {
             subtract(other.doubleValue());
         }
@@ -615,7 +653,7 @@ public final class DoubleDouble extends
      * <b>Tip:</b> if the other value is known to be an integer or a power of 2, then invoking
      * <code>{@linkplain #subtract(double, double) subtract}(otherValue, 0)</code> is more efficient.
      *
-     * @param otherValue The other value to subtract from this {@code DoubleDouble}.
+     * @param  otherValue  the other value to subtract from this {@code DoubleDouble}.
      */
     public void subtract(final double otherValue) {
         subtract(otherValue, errorForWellKnownValue(otherValue));
@@ -625,8 +663,8 @@ public final class DoubleDouble extends
      * Subtracts an other double-double value from this {@code DoubleDouble}.
      * The result is stored in this instance.
      *
-     * @param otherValue The other value to subtract from this {@code DoubleDouble}.
-     * @param otherError The error of the other value to subtract from this {@code DoubleDouble}.
+     * @param  otherValue  the other value to subtract from this {@code DoubleDouble}.
+     * @param  otherError  the error of the other value to subtract from this {@code DoubleDouble}.
      */
     public void subtract(final double otherValue, final double otherError) {
         add(-otherValue, -otherError);
@@ -640,9 +678,9 @@ public final class DoubleDouble extends
      *    subtract(array[index], array[index + errorOffset]);
      * }
      *
-     * @param array        The array from which to get the value and error.
-     * @param index        Index of the value in the given array.
-     * @param errorOffset  Offset to add to {@code index} in order to get the index of the error in the given array.
+     * @param  array        the array from which to get the value and error.
+     * @param  index        index of the value in the given array.
+     * @param  errorOffset  offset to add to {@code index} in order to get the index of the error in the given array.
      */
     public void subtract(final double[] array, final int index, final int errorOffset) {
         subtract(array[index], array[index + errorOffset]);
@@ -656,7 +694,7 @@ public final class DoubleDouble extends
      *    multiply(other.value, other.error);
      * }
      *
-     * @param other The other value to multiply by this value.
+     * @param  other  the other value to multiply by this value.
      */
     public void multiply(final DoubleDouble other) {
         multiply(other.value, other.error);
@@ -664,13 +702,15 @@ public final class DoubleDouble extends
 
     /**
      * Multiplies this {@code DoubleDouble} by a {@code Number}. If the given number is an instance
-     * of {@code DoubleDouble}, then its error term will be taken in account.
+     * of {@code DoubleDouble} or {@link Fraction}, then the error term will be taken in account.
      *
-     * @param other The other value to multiply by this {@code DoubleDouble}.
+     * @param  other  the other value to multiply by this {@code DoubleDouble}.
      */
     public void multiply(final Number other) {
         if (other instanceof DoubleDouble) {
             multiply((DoubleDouble) other);
+        } else if (shouldConvert(other)) {
+            multiply(new DoubleDouble(other));
         } else {
             multiply(other.doubleValue());
         }
@@ -687,7 +727,7 @@ public final class DoubleDouble extends
      * <b>Tip:</b> if the other value is known to be an integer or a power of 2, then invoking
      * <code>{@linkplain #multiply(double, double) multiply}(otherValue, 0)</code> is more efficient.
      *
-     * @param otherValue The other value to multiply by this {@code DoubleDouble}.
+     * @param  otherValue  the other value to multiply by this {@code DoubleDouble}.
      */
     public void multiply(final double otherValue) {
         multiply(otherValue, errorForWellKnownValue(otherValue));
@@ -721,8 +761,8 @@ public final class DoubleDouble extends
      *   setToQuickSum(value, error);
      * }
      *
-     * @param otherValue The other value by which to multiply this {@code DoubleDouble}.
-     * @param otherError The error of the other value by which to multiply this {@code DoubleDouble}.
+     * @param  otherValue  the other value by which to multiply this {@code DoubleDouble}.
+     * @param  otherError  the error of the other value by which to multiply this {@code DoubleDouble}.
      */
     public void multiply(final double otherValue, final double otherError) {
         final double thisValue = this.value;
@@ -741,9 +781,9 @@ public final class DoubleDouble extends
      *    multiply(array[index], array[index + errorOffset]);
      * }
      *
-     * @param array        The array from which to get the value and error.
-     * @param index        Index of the value in the given array.
-     * @param errorOffset  Offset to add to {@code index} in order to get the index of the error in the given array.
+     * @param  array        the array from which to get the value and error.
+     * @param  index        index of the value in the given array.
+     * @param  errorOffset  offset to add to {@code index} in order to get the index of the error in the given array.
      */
     public void multiply(final double[] array, final int index, final int errorOffset) {
         multiply(array[index], array[index + errorOffset]);
@@ -757,7 +797,7 @@ public final class DoubleDouble extends
      *    divide(other.value, other.error);
      * }
      *
-     * @param other The other value to by which to divide this value.
+     * @param  other  the other value to by which to divide this value.
      */
     public void divide(final DoubleDouble other) {
         divide(other.value, other.error);
@@ -765,13 +805,15 @@ public final class DoubleDouble extends
 
     /**
      * Divides this {@code DoubleDouble} by a {@code Number}. If the given number is an instance
-     * of {@code DoubleDouble}, then its error term will be taken in account.
+     * of {@code DoubleDouble} or {@link Fraction}, then the error term will be taken in account.
      *
-     * @param other The other value by which to divide this {@code DoubleDouble}.
+     * @param  other  the other value by which to divide this {@code DoubleDouble}.
      */
     public void divide(final Number other) {
         if (other instanceof DoubleDouble) {
             divide((DoubleDouble) other);
+        } else if (shouldConvert(other)) {
+            divide(new DoubleDouble(other));
         } else {
             divide(other.doubleValue());
         }
@@ -788,7 +830,7 @@ public final class DoubleDouble extends
      * <b>Tip:</b> if the other value is known to be an integer or a power of 2, then invoking
      * <code>{@linkplain #divide(double, double) divide}(otherValue, 0)</code> is more efficient.
      *
-     * @param otherValue The other value by which to divide this {@code DoubleDouble}.
+     * @param  otherValue  the other value by which to divide this {@code DoubleDouble}.
      */
     public void divide(final double otherValue) {
         divide(otherValue, errorForWellKnownValue(otherValue));
@@ -798,8 +840,8 @@ public final class DoubleDouble extends
      * Divides this {@code DoubleDouble} by an other double-double value.
      * The result is stored in this instance.
      *
-     * @param denominatorValue The other value by which to divide this {@code DoubleDouble}.
-     * @param denominatorError The error of the other value by which to divide this {@code DoubleDouble}.
+     * @param  denominatorValue  the other value by which to divide this {@code DoubleDouble}.
+     * @param  denominatorError  the error of the other value by which to divide this {@code DoubleDouble}.
      */
     public void divide(final double denominatorValue, final double denominatorError) {
         if (DISABLED) {
@@ -822,9 +864,9 @@ public final class DoubleDouble extends
      *    divide(array[index], array[index + errorOffset]);
      * }
      *
-     * @param array        The array from which to get the value and error.
-     * @param index        Index of the value in the given array.
-     * @param errorOffset  Offset to add to {@code index} in order to get the index of the error in the given array.
+     * @param  array        the array from which to get the value and error.
+     * @param  index        index of the value in the given array.
+     * @param  errorOffset  offset to add to {@code index} in order to get the index of the error in the given array.
      */
     public void divide(final double[] array, final int index, final int errorOffset) {
         divide(array[index], array[index + errorOffset]);
@@ -838,21 +880,23 @@ public final class DoubleDouble extends
      *    inverseDivide(other.value, other.error);
      * }
      *
-     * @param other The other value to divide by this value.
+     * @param  other  the other value to divide by this value.
      */
     public void inverseDivide(final DoubleDouble other) {
         inverseDivide(other.value, other.error);
     }
 
     /**
-     * Divides the given {@code Number} value by this {@code DoubleDouble}. If the given number
-     * is an instance of {@code DoubleDouble}, then its error term will be taken in account.
+     * Divides the given {@code Number} value by this {@code DoubleDouble}. If the given number is an instance
+     * of {@code DoubleDouble} or {@link Fraction}, then the error term will be taken in account.
      *
-     * @param other The other value to divide by this {@code DoubleDouble}.
+     * @param  other  the other value to divide by this {@code DoubleDouble}.
      */
     public void inverseDivide(final Number other) {
         if (other instanceof DoubleDouble) {
             inverseDivide((DoubleDouble) other);
+        } else if (shouldConvert(other)) {
+            inverseDivide(new DoubleDouble(other));
         } else {
             inverseDivide(other.doubleValue());
         }
@@ -869,7 +913,7 @@ public final class DoubleDouble extends
      * <b>Tip:</b> if the other value is known to be an integer or a power of 2, then invoking
      * <code>{@linkplain #inverseDivide(double, double) inverseDivide}(otherValue, 0)</code> is more efficient.
      *
-     * @param numeratorValue The other value to divide by this {@code DoubleDouble}.
+     * @param  numeratorValue  the other value to divide by this {@code DoubleDouble}.
      */
     public void inverseDivide(final double numeratorValue) {
         inverseDivide(numeratorValue, errorForWellKnownValue(numeratorValue));
@@ -888,8 +932,8 @@ public final class DoubleDouble extends
      *
      *   <blockquote>remainder = a - b * (a.value / b.value)</blockquote>
      *
-     * @param numeratorValue The other value to divide by this {@code DoubleDouble}.
-     * @param numeratorError The error of the other value to divide by this {@code DoubleDouble}.
+     * @param  numeratorValue  the other value to divide by this {@code DoubleDouble}.
+     * @param  numeratorError  the error of the other value to divide by this {@code DoubleDouble}.
      */
     public void inverseDivide(final double numeratorValue, final double numeratorError) {
         if (DISABLED) {
@@ -926,9 +970,9 @@ public final class DoubleDouble extends
      *    inverseDivide(array[index], array[index + errorOffset]);
      * }
      *
-     * @param array        The array from which to get the value and error.
-     * @param index        Index of the value in the given array.
-     * @param errorOffset  Offset to add to {@code index} in order to get the index of the error in the given array.
+     * @param  array        the array from which to get the value and error.
+     * @param  index        index of the value in the given array.
+     * @param  errorOffset  offset to add to {@code index} in order to get the index of the error in the given array.
      */
     public void inverseDivide(final double[] array, final int index, final int errorOffset) {
         inverseDivide(array[index], array[index + errorOffset]);
@@ -1015,7 +1059,7 @@ public final class DoubleDouble extends
     /**
      * Returns a hash code value for this number.
      *
-     * @return A hash code value.
+     * @return a hash code value.
      */
     @Override
     public int hashCode() {
@@ -1025,7 +1069,7 @@ public final class DoubleDouble extends
     /**
      * Compares this number with the given object for equality.
      *
-     * @param  obj The other object to compare with this number.
+     * @param  obj  the other object to compare with this number.
      * @return {@code true} if both object are equal.
      */
     @Override
@@ -1044,7 +1088,7 @@ public final class DoubleDouble extends
      * Returns a string representation of this number for debugging purpose.
      * The returned string does not need to contains all digits that this {@code DoubleDouble} can handle.
      *
-     * @return A string representation of this number.
+     * @return a string representation of this number.
      */
     @Override
     public String toString() {