Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-32

[math] MathUtils round Method issues

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: Other

    • Bugzilla Id:
      35904

      Description

      I was trying to use this class to round my float values.
      class ==> org.apache.commons.math.util.MathUtils
      method ==> round(float,scale)
      Input 30.095 output 30.09 - ( i think should be 30.1)
      Input 33.095 putput 33.1 - Correct
      Input 50.085 output 50.08 - should have been 50.09
      Input 50.185 output 50.19 - Correct
      Input 50.005 output 50.01 - correct
      Input 30.005 out put 30.0 - wrong
      30.645 output - 30.65 - correct
      So it seems there is some inconsistency. Not sure if its because of the how
      BigDecimal.ROUND_HALF_UP works. but still the data is inconsistent.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vemurys@hotmail.com Srinivas Vemury
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: