Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8186713

Document default rounding mode in NumberFormat

    Details

    • Subcomponent:
    • Resolved In Build:
      b22
    • CPU:
      other
    • OS:
      generic
    • Verification:
      Not verified

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nishjain Nishit Jain
                Reporter:
                nishjain Nishit Jain
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: