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

Misleading documentation in java.math.RoundingMode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • None
    • core-libs
    • None

      java.math.RoundingMode.HALF_UP announces that it is the rounding mode commonly taught in school. I believe this is a mistake since the commonly used rounding mode should be round to the nearest ties to positive infinity, which is the behaviour of Math.round. This comment is also presented in BigDecimal.ROUND_HALF_UP.

      Also, maybe we should have some more clarifications on the behaviours of round up and round down since normally the former means toward positive infinity and the opposite goes for the latter and Java seems to use these words with different meanings from their mathematical counterparts.

            rgiulietti Raffaello Giulietti
            qamai Quan Anh Mai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: