jscience
  1. jscience
  2. JSCIENCE-118

FloatingPoint.round and LargeInteger.FIVE are broken

    Details

    • Type: Task Task
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: Version 6.0
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      118

      Description

      FloatingPoint.round(FloatingPoint.valueOf(0.9)) yields 0 instead of 1.
      This is due to two bugs:
      LargeInteger.FIVE has copy and paste errors: it should be
      static final LargeInteger FIVE = new LargeInteger(1);
      static

      { FIVE._words[0] = 5; FIVE._size = 1; }

      (By the way: shouldn't LargeInteger.LONG_MIN_VALUE be negative?)

      Second, the third line of FloatingPoint.round should read
      LargeInteger half = LargeInteger.FIVE.times10pow(-_exponent-1);
      instead of
      LargeInteger half = LargeInteger.FIVE.times10pow(_exponent - 1);

      The same problem applies to Real.

        Activity

        Hide
        hstoerr added a comment -

        This should be a patch instead of an issue, since I included a fix.
        Tests to verify the fix are included in issue 120.

        Show
        hstoerr added a comment - This should be a patch instead of an issue, since I included a fix. Tests to verify the fix are included in issue 120.

          People

          • Assignee:
            jscience-issues
            Reporter:
            hstoerr
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: