From b0655713d8f8f8ec6684a133a8795b0cdac00ae8 Mon Sep 17 00:00:00 2001 From: sherman Date: Thu, 17 Mar 2011 11:42:39 -0700 Subject: [PATCH] 6796662: (fmt spec) Formatter spec on BigDecimal output should not reference Float a Summary: updated the spec doc Reviewed-by: alanb --- src/share/classes/java/util/Formatter.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/share/classes/java/util/Formatter.java b/src/share/classes/java/util/Formatter.java index 797b9e2f8..6dcf87880 100644 --- a/src/share/classes/java/util/Formatter.java +++ b/src/share/classes/java/util/Formatter.java @@ -1401,10 +1401,9 @@ import sun.misc.FormattedFloatingDecimal; *

The number of digits in the result for the fractional part of * m or a is equal to the precision. If the precision is not * specified then the default value is {@code 6}. If the precision is - * less than the number of digits which would appear after the decimal - * point in the string returned by {@link Float#toString(float)} or {@link - * Double#toString(double)} respectively, then the value will be rounded - * using the {@linkplain java.math.BigDecimal#ROUND_HALF_UP round half up + * less than the number of digits to the right of the decimal point then + * the value will be rounded using the + * {@linkplain java.math.BigDecimal#ROUND_HALF_UP round half up * algorithm}. Otherwise, zeros may be appended to reach the precision. * For a canonical representation of the value, use {@link * BigDecimal#toString()}. @@ -1463,12 +1462,11 @@ import sun.misc.FormattedFloatingDecimal; * more decimal digits representing the fractional part of m. * *

The number of digits in the result for the fractional part of - * m or a is equal to the precision. If the precision is not + * m or a is equal to the precision. If the precision is not * specified then the default value is {@code 6}. If the precision is - * less than the number of digits which would appear after the decimal - * point in the string returned by {@link Float#toString(float)} or {@link - * Double#toString(double)} respectively, then the value will be rounded - * using the {@linkplain java.math.BigDecimal#ROUND_HALF_UP round half up + * less than the number of digits to the right of the decimal point + * then the value will be rounded using the + * {@linkplain java.math.BigDecimal#ROUND_HALF_UP round half up * algorithm}. Otherwise, zeros may be appended to reach the precision. * For a canonical representation of the value, use {@link * BigDecimal#toString()}. @@ -3585,7 +3583,7 @@ public final class Formatter implements Closeable, Flushable { int scale = value.scale(); if (scale > prec) { - // more "scale" digits than the requested "precision + // more "scale" digits than the requested "precision" int compPrec = value.precision(); if (compPrec <= scale) { // case of 0.xxxxxx -- GitLab