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

Unsigned operations

Rank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 4.0
    • 4.0
    • None

    Description

      Add unsigned operations to ArithmeticUtils: divideUnsigned and remainderUnsigned. They exist in java.lang.Integer and java.lang.Long since Java 8. The inner implementation is based on leveraging to long (for ints) and to BigInteger (for longs). Comments in code suggest using tricks described in "Hacker's Delight" to stay with smaller type (int and long respectively). Those tricks were implemented in this pull request: https://github.com/apache/commons-math/pull/13

      I don't know if using an algorithm from "Hacker's Delight" is compatible with Apache license. The code is faster than standard Java 8 implementation: 2 times for int and 8 times for long (verified with simple small tests).

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            Qualtagh Qualtagh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment