You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles Sadowski (Jira)" <ji...@apache.org> on 2023/01/18 11:05:00 UTC

[jira] [Commented] (NUMBERS-192) Add subtract method to Sum

    [ https://issues.apache.org/jira/browse/NUMBERS-192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17678192#comment-17678192 ] 

Gilles Sadowski commented on NUMBERS-192:
-----------------------------------------

+1

> Add subtract method to Sum
> --------------------------
>
>                 Key: NUMBERS-192
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-192
>             Project: Commons Numbers
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.1
>            Reporter: Alex Herbert
>            Priority: Trivial
>
> 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:
> {code:java}
> Sum.of(1, -2, 3, -4, 5).add(-6).add(7)
> {code}
> 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:
> {code:java}
> public Sum subtract(Sum other){code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)