Uploaded image for project: 'Commons Numbers'
  1. Commons Numbers
  2. NUMBERS-192

Add subtract method to Sum

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Implemented
    • 1.1
    • 1.2
    • core
    • None
    • Easy

    Description

      The Sum class can be used to add and subtract many terms. Subtraction of individual terms is performed by negating the argument and using the add method:

      Sum.of(1, -2, 3, -4, 5).add(-6).add(7)
      

      However there is no subtract method for subtraction of another sum to complement the add(Sum) method. This prevents using the extended precision part of the Sum in subtraction.

      I suggest adding:

      public Sum subtract(Sum other)

      Attachments

        Activity

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

          People

            Unassigned Unassigned
            aherbert Alex Herbert
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment