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

[math] MathUtils round Method issues

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None
    • Operating System: Windows XP
      Platform: Other

    • 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

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: