-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b22
-
other
-
generic
-
Not verified
Problem Statement
=================
Document default rounding mode in NumberFormat
Document Location
=================
Update both at the class level (NumberFormat.html), and at the static method
getNumberInstance level (NumberFormat.html#getNumberInstance)
public static final NumberFormat getNumberInstance()
Returns a general-purpose number format for the current default locale.
public static NumberFormat getNumberInstance(Locale inLocale)
Returns a general-purpose number format for the specified locale.
URL
===
http://docs.oracle.com/javase/7/docs/api/java/text/NumberFormat.html#getNumberInstance()
What is wrong
=============
The javadoc of NumberFormat should be updated both at the class level, and
at the static method getNumberInstance() level to indicate that a
"general-purpose" number format for the current default locale may not use a
your locale's "default" rounding format for decimal number rounding and that
where rounding control is required the #setRoundingMode() method must then
be called.
Furthermore, it should be highlighted that the default rounding mode may be
inconsistent with other default rounding modes used by other standard jdk
classes, such as java.util.Formatter.
Additionally, the javadoc for String.format should be updated to specify the
default (hard-coded) rounding mode used.
http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#format(java.lang.String, java.lang.Object...)
The Formatter default is documented:
http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#dndec
Float and Double
...the value will be rounded using the round half up algorithm.
=================
Document default rounding mode in NumberFormat
Document Location
=================
Update both at the class level (NumberFormat.html), and at the static method
getNumberInstance level (NumberFormat.html#getNumberInstance)
public static final NumberFormat getNumberInstance()
Returns a general-purpose number format for the current default locale.
public static NumberFormat getNumberInstance(Locale inLocale)
Returns a general-purpose number format for the specified locale.
URL
===
http://docs.oracle.com/javase/7/docs/api/java/text/NumberFormat.html#getNumberInstance()
What is wrong
=============
The javadoc of NumberFormat should be updated both at the class level, and
at the static method getNumberInstance() level to indicate that a
"general-purpose" number format for the current default locale may not use a
your locale's "default" rounding format for decimal number rounding and that
where rounding control is required the #setRoundingMode() method must then
be called.
Furthermore, it should be highlighted that the default rounding mode may be
inconsistent with other default rounding modes used by other standard jdk
classes, such as java.util.Formatter.
Additionally, the javadoc for String.format should be updated to specify the
default (hard-coded) rounding mode used.
http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#format(java.lang.String, java.lang.Object...)
The Formatter default is documented:
http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#dndec
Float and Double
...the value will be rounded using the round half up algorithm.
- csr for
-
JDK-8185777 Document default rounding mode in NumberFormat
-
- Closed
-
- relates to
-
JDK-6979872 NumberFormat.getNumberInstance() uses RoundingMode.HALF_EVEN instead of HALF_UP
-
- Closed
-
- links to