< prev index next >

src/java.base/share/classes/java/math/BigDecimal.java

Print this page

        

@@ -38,11 +38,11 @@
  * <i>unscaled value</i> and a 32-bit integer <i>scale</i>.  If zero
  * or positive, the scale is the number of digits to the right of the
  * decimal point.  If negative, the unscaled value of the number is
  * multiplied by ten to the power of the negation of the scale.  The
  * value of the number represented by the {@code BigDecimal} is
- * therefore <tt>(unscaledValue &times; 10<sup>-scale</sup>)</tt>.
+ * therefore <code>(unscaledValue &times; 10<sup>-scale</sup>)</code>.
  *
  * <p>The {@code BigDecimal} class provides operations for
  * arithmetic, scale manipulation, rounding, comparison, hashing, and
  * format conversion.  The {@link #toString} method provides a
  * canonical representation of a {@code BigDecimal}.

@@ -707,23 +707,23 @@
     }
 
     /**
      * Translates the string representation of a {@code BigDecimal}
      * into a {@code BigDecimal}.  The string representation consists
-     * of an optional sign, {@code '+'} (<tt> '\u002B'</tt>) or
-     * {@code '-'} (<tt>'\u002D'</tt>), followed by a sequence of
+     * of an optional sign, {@code '+'} (<code> '\u002B'</code>) or
+     * {@code '-'} (<code>'\u002D'</code>), followed by a sequence of
      * zero or more decimal digits ("the integer"), optionally
      * followed by a fraction, optionally followed by an exponent.
      *
      * <p>The fraction consists of a decimal point followed by zero
      * or more decimal digits.  The string must contain at least one
      * digit in either the integer or the fraction.  The number formed
      * by the sign, the integer and the fraction is referred to as the
      * <i>significand</i>.
      *
      * <p>The exponent consists of the character {@code 'e'}
-     * (<tt>'\u0065'</tt>) or {@code 'E'} (<tt>'\u0045'</tt>)
+     * (<code>'\u0065'</code>) or {@code 'E'} (<code>'\u0045'</code>)
      * followed by one or more decimal digits.  The value of the
      * exponent must lie between -{@link Integer#MAX_VALUE} ({@link
      * Integer#MIN_VALUE}+1) and {@link Integer#MAX_VALUE}, inclusive.
      *
      * <p>More formally, the strings this constructor accepts are

@@ -832,11 +832,11 @@
     /**
      * Translates a {@code double} into a {@code BigDecimal} which
      * is the exact decimal representation of the {@code double}'s
      * binary floating-point value.  The scale of the returned
      * {@code BigDecimal} is the smallest value such that
-     * <tt>(10<sup>scale</sup> &times; val)</tt> is an integer.
+     * <code>(10<sup>scale</sup> &times; val)</code> is an integer.
      * <p>
      * <b>Notes:</b>
      * <ol>
      * <li>
      * The results of this constructor can be somewhat unpredictable.

@@ -854,12 +854,12 @@
      * <li>
      * The {@code String} constructor, on the other hand, is
      * perfectly predictable: writing {@code new BigDecimal("0.1")}
      * creates a {@code BigDecimal} which is <i>exactly</i> equal to
      * 0.1, as one would expect.  Therefore, it is generally
-     * recommended that the {@linkplain #BigDecimal(String)
-     * <tt>String</tt> constructor} be used in preference to this one.
+     * recommended that the <code>{@linkplain #BigDecimal(String)
+     * String constructor}</code> be used in preference to this one.
      *
      * <li>
      * When a {@code double} must be used as a source for a
      * {@code BigDecimal}, note that this constructor provides an
      * exact conversion; it does not give the same result as

@@ -879,11 +879,11 @@
 
     /**
      * Translates a {@code double} into a {@code BigDecimal}, with
      * rounding according to the context settings.  The scale of the
      * {@code BigDecimal} is the smallest value such that
-     * <tt>(10<sup>scale</sup> &times; val)</tt> is an integer.
+     * <code>(10<sup>scale</sup> &times; val)</code> is an integer.
      *
      * <p>The results of this constructor can be somewhat unpredictable
      * and its use is generally not recommended; see the notes under
      * the {@link #BigDecimal(double)} constructor.
      *

@@ -1008,11 +1008,11 @@
 
     /**
      * Translates a {@code BigInteger} unscaled value and an
      * {@code int} scale into a {@code BigDecimal}.  The value of
      * the {@code BigDecimal} is
-     * <tt>(unscaledVal &times; 10<sup>-scale</sup>)</tt>.
+     * <code>(unscaledVal &times; 10<sup>-scale</sup>)</code>.
      *
      * @param unscaledVal unscaled value of the {@code BigDecimal}.
      * @param scale scale of the {@code BigDecimal}.
      */
     public BigDecimal(BigInteger unscaledVal, int scale) {

@@ -1024,12 +1024,12 @@
 
     /**
      * Translates a {@code BigInteger} unscaled value and an
      * {@code int} scale into a {@code BigDecimal}, with rounding
      * according to the context settings.  The value of the
-     * {@code BigDecimal} is <tt>(unscaledVal &times;
-     * 10<sup>-scale</sup>)</tt>, rounded according to the
+     * {@code BigDecimal} is <code>(unscaledVal &times;
+     * 10<sup>-scale</sup>)</code>, rounded according to the
      * {@code precision} and rounding mode settings.
      *
      * @param  unscaledVal unscaled value of the {@code BigDecimal}.
      * @param  scale scale of the {@code BigDecimal}.
      * @param  mc the context to use.

@@ -1194,11 +1194,11 @@
      * allows for reuse of frequently used {@code BigDecimal} values..
      *
      * @param unscaledVal unscaled value of the {@code BigDecimal}.
      * @param scale scale of the {@code BigDecimal}.
      * @return a {@code BigDecimal} whose value is
-     *         <tt>(unscaledVal &times; 10<sup>-scale</sup>)</tt>.
+     *         <code>(unscaledVal &times; 10<sup>-scale</sup>)</code>.
      */
     public static BigDecimal valueOf(long unscaledVal, int scale) {
         if (scale == 0)
             return valueOf(unscaledVal);
         else if (unscaledVal == 0) {

@@ -1474,12 +1474,12 @@
         // share the special rounding code in add()
         return add(subtrahend.negate(), mc);
     }
 
     /**
-     * Returns a {@code BigDecimal} whose value is <tt>(this &times;
-     * multiplicand)</tt>, and whose scale is {@code (this.scale() +
+     * Returns a {@code BigDecimal} whose value is <code>(this &times;
+     * multiplicand)</code>, and whose scale is {@code (this.scale() +
      * multiplicand.scale())}.
      *
      * @param  multiplicand value to be multiplied by this {@code BigDecimal}.
      * @return {@code this * multiplicand}
      */

@@ -1499,12 +1499,12 @@
             }
         }
     }
 
     /**
-     * Returns a {@code BigDecimal} whose value is <tt>(this &times;
-     * multiplicand)</tt>, with rounding according to the context settings.
+     * Returns a {@code BigDecimal} whose value is <code>(this &times;
+     * multiplicand)</code>, with rounding according to the context settings.
      *
      * @param  multiplicand value to be multiplied by this {@code BigDecimal}.
      * @param  mc the context to use.
      * @return {@code this * multiplicand}, rounded as necessary.
      * @throws ArithmeticException if the result is inexact but the

@@ -1993,22 +1993,22 @@
         return result;
     }
 
     /**
      * Returns a {@code BigDecimal} whose value is
-     * <tt>(this<sup>n</sup>)</tt>, The power is computed exactly, to
+     * <code>(this<sup>n</sup>)</code>, The power is computed exactly, to
      * unlimited precision.
      *
      * <p>The parameter {@code n} must be in the range 0 through
      * 999999999, inclusive.  {@code ZERO.pow(0)} returns {@link
      * #ONE}.
      *
      * Note that future releases may expand the allowable exponent
      * range of this method.
      *
      * @param  n power to raise this {@code BigDecimal} to.
-     * @return <tt>this<sup>n</sup></tt>
+     * @return <code>this<sup>n</sup></code>
      * @throws ArithmeticException if {@code n} is out of range.
      * @since  1.5
      */
     public BigDecimal pow(int n) {
         if (n < 0 || n > 999999999)

@@ -2020,11 +2020,11 @@
     }
 
 
     /**
      * Returns a {@code BigDecimal} whose value is
-     * <tt>(this<sup>n</sup>)</tt>.  The current implementation uses
+     * <code>(this<sup>n</sup>)</code>.  The current implementation uses
      * the core algorithm defined in ANSI standard X3.274-1996 with
      * rounding according to the context settings.  In general, the
      * returned numerical value is within two ulps of the exact
      * numerical value for the chosen precision.  Note that future
      * releases may use a different algorithm with a decreased

@@ -2061,11 +2061,11 @@
      *   </ul>
      * </ul>
      *
      * @param  n power to raise this {@code BigDecimal} to.
      * @param  mc the context to use.
-     * @return <tt>this<sup>n</sup></tt> using the ANSI standard X3.274-1996
+     * @return <code>this<sup>n</sup></code> using the ANSI standard X3.274-1996
      *         algorithm
      * @throws ArithmeticException if the result is inexact but the
      *         rounding mode is {@code UNNECESSARY}, or {@code n} is out
      *         of range.
      * @since  1.5

@@ -2249,12 +2249,12 @@
     }
 
 
     /**
      * Returns a {@code BigInteger} whose value is the <i>unscaled
-     * value</i> of this {@code BigDecimal}.  (Computes <tt>(this *
-     * 10<sup>this.scale()</sup>)</tt>.)
+     * value</i> of this {@code BigDecimal}.  (Computes <code>(this *
+     * 10<sup>this.scale()</sup>)</code>.)
      *
      * @return the unscaled value of this {@code BigDecimal}.
      * @since  1.2
      */
     public BigInteger unscaledValue() {

@@ -2369,11 +2369,11 @@
      * division.
      *
      * <p>Note that since BigDecimal objects are immutable, calls of
      * this method do <i>not</i> result in the original object being
      * modified, contrary to the usual convention of having methods
-     * named <tt>set<i>X</i></tt> mutate field <i>{@code X}</i>.
+     * named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
      * Instead, {@code setScale} returns an object with the proper
      * scale; the returned object may or may not be newly allocated.
      *
      * @param  newScale scale of the {@code BigDecimal} value to be returned.
      * @param  roundingMode The rounding mode to apply.

@@ -2402,11 +2402,11 @@
      * division.
      *
      * <p>Note that since BigDecimal objects are immutable, calls of
      * this method do <i>not</i> result in the original object being
      * modified, contrary to the usual convention of having methods
-     * named <tt>set<i>X</i></tt> mutate field <i>{@code X}</i>.
+     * named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
      * Instead, {@code setScale} returns an object with the proper
      * scale; the returned object may or may not be newly allocated.
      *
      * <p>The new {@link #setScale(int, RoundingMode)} method should
      * be used in preference to this legacy method.

@@ -2496,11 +2496,11 @@
      * of specifying a rounding mode in cases where it is irrelevant.
      *
      * <p>Note that since {@code BigDecimal} objects are immutable,
      * calls of this method do <i>not</i> result in the original
      * object being modified, contrary to the usual convention of
-     * having methods named <tt>set<i>X</i></tt> mutate field
+     * having methods named <code>set<i>X</i></code> mutate field
      * <i>{@code X}</i>.  Instead, {@code setScale} returns an
      * object with the proper scale; the returned object may or may
      * not be newly allocated.
      *
      * @param  newScale scale of the {@code BigDecimal} value to be returned.

@@ -2523,12 +2523,12 @@
      * Returns a {@code BigDecimal} which is equivalent to this one
      * with the decimal point moved {@code n} places to the left.  If
      * {@code n} is non-negative, the call merely adds {@code n} to
      * the scale.  If {@code n} is negative, the call is equivalent
      * to {@code movePointRight(-n)}.  The {@code BigDecimal}
-     * returned by this call has value <tt>(this &times;
-     * 10<sup>-n</sup>)</tt> and scale {@code max(this.scale()+n,
+     * returned by this call has value <code>(this &times;
+     * 10<sup>-n</sup>)</code> and scale {@code max(this.scale()+n,
      * 0)}.
      *
      * @param  n number of places to move the decimal point to the left.
      * @return a {@code BigDecimal} which is equivalent to this one with the
      *         decimal point moved {@code n} places to the left.

@@ -2545,12 +2545,12 @@
      * Returns a {@code BigDecimal} which is equivalent to this one
      * with the decimal point moved {@code n} places to the right.
      * If {@code n} is non-negative, the call merely subtracts
      * {@code n} from the scale.  If {@code n} is negative, the call
      * is equivalent to {@code movePointLeft(-n)}.  The
-     * {@code BigDecimal} returned by this call has value <tt>(this
-     * &times; 10<sup>n</sup>)</tt> and scale {@code max(this.scale()-n,
+     * {@code BigDecimal} returned by this call has value <code>(this
+     * &times; 10<sup>n</sup>)</code> and scale {@code max(this.scale()-n,
      * 0)}.
      *
      * @param  n number of places to move the decimal point to the right.
      * @return a {@code BigDecimal} which is equivalent to this one
      *         with the decimal point moved {@code n} places to the right.

@@ -2823,16 +2823,16 @@
      * unscaled value (perhaps with inserted decimal point); this
      * comprises the letter {@code 'E'} followed immediately by the
      * adjusted exponent converted to a character form.  The latter is
      * in base ten, using the characters {@code '0'} through
      * {@code '9'} with no leading zeros, and is always prefixed by a
-     * sign character {@code '-'} (<tt>'\u002D'</tt>) if the
+     * sign character {@code '-'} (<code>'\u002D'</code>) if the
      * adjusted exponent is negative, {@code '+'}
-     * (<tt>'\u002B'</tt>) otherwise).
+     * (<code>'\u002B'</code>) otherwise).
      *
      * <p>Finally, the entire string is prefixed by a minus sign
-     * character {@code '-'} (<tt>'\u002D'</tt>) if the unscaled
+     * character {@code '-'} (<code>'\u002D'</code>) if the unscaled
      * value is less than zero.  No sign character is prefixed if the
      * unscaled value is zero or positive.
      *
      * <p><b>Examples:</b>
      * <p>For each representation [<i>unscaled value</i>, <i>scale</i>]

@@ -2928,11 +2928,11 @@
      * converted to a numerically equal value with zero scale and as
      * if all the trailing zeros of the zero scale value were present
      * in the result.
      *
      * The entire string is prefixed by a minus sign character '-'
-     * (<tt>'\u002D'</tt>) if the unscaled value is less than
+     * (<code>'\u002D'</code>) if the unscaled value is less than
      * zero. No sign character is prefixed if the unscaled value is
      * zero or positive.
      *
      * Note that if the result of this method is passed to the
      * {@linkplain #BigDecimal(String) string constructor}, only the
< prev index next >