commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Commented] (MATH-1043) MathUtils.sum() method to add together a bunch of numbers.
Date Fri, 18 Oct 2013 09:52:45 GMT


Gilles commented on MATH-1043:

Thomas, Phil,

bq. I doubt that any math user will ever use a method like this.

It depends from what angle you see this feature.
The purpose may well be that people who want this feature should use CM rather than CL.
It is (too obviously?) a mathematical operation.
Besides, this is rightly going to be in a "XxxUtils" class.

bq. [...] dread over extending all of the double[]-taking methods in [math] to var args [...]

Without further motivated requests, that's certainly not the intention.

This feature can be more useful as an extension of what is already in CM (which includes overflow
checking), than as a just syntactic sugar implemented in CL. Also, avoiding (however small)
duplication, especially between Commons components is a worthy goal IMO (as I pointed out
recently in one of the threads on the ML). And it makes more sense (IMHO) to add this in CM
rather than have a trivial extension in CL depend on CM.

> MathUtils.sum() method to add together a bunch of numbers.
> ----------------------------------------------------------
>                 Key: MATH-1043
>                 URL:
>             Project: Commons Math
>          Issue Type: New Feature
>         Environment: Any
>            Reporter: Matt Bishop
>            Priority: Minor
> I find myself doing sums frequently with a variety of numbers. It would be nice if MathUtils
had a method like this:
>     int add(int... numbers);

This message was sent by Atlassian JIRA

View raw message