jscience
  1. jscience
  2. JSCIENCE-123

Fix for "-0" == FloatingPoint.valueOf(Biginteger(-1))

    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:
      123

      Description

      This solves Bug#72: LargeInteger.valueOf(java.math.BigInteger.valueOf(-1)) is "-0".
      The problem is that in LargeInteger.valueOf(bytes,offset,length) the _size is
      incorrectly set to 0 in this case. My fix for that is to include the line
      if (isNegative && wordIndex < 0) wordIndex = 0; // special case for -1
      just before
      li._size = wordIndex + 1;

      Caution: I don't understand the code completely and this is probably not the
      most elegant fix. It seems to work though - my unittests verify this works with
      a number of values.

        Activity

        There are no comments yet on this issue.

          People

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

            Dates

            • Created:
              Updated: