jscience
  1. jscience
  2. JSCIENCE-72

LargeInteger#valueOf(BigInteger) returns incorrect result for -1 possibly others?

    Details

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

      Operating System: Mac OS X
      Platform: Macintosh

    • Issuezilla Id:
      72

      Description

      Using version 4.3.1 LargeInteger#valueOf(BigInteger) converts the BigInteger
      value "-1" into the LargeInteger value "-0":

      assertEquals(-1, LargeInteger.valueOf(new BigInteger("-1")).intValue());

      I have not investigated deeply but on face value this appears to be a missed
      corner case.

      My workaround is to use the String version of the factory:

      LargeInteger.valueOf(someBigInteger.toString())

        Activity

        hutchiko created issue -
        kenaiadmin made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 72 63231
        dautelle made changes -
        Fix Version/s Version 6.0 [ 14597 ]
        Fix Version/s milestone 1 [ 12327 ]

          People

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

            Dates

            • Created:
              Updated: