You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alex Herbert (Jira)" <ji...@apache.org> on 2023/01/18 00:03:00 UTC
[jira] [Created] (NUMBERS-192) Add subtract method to Sum
Alex Herbert created NUMBERS-192:
------------------------------------
Summary: 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
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)