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

Matt Juntunen commented on NUMBERS-163:
---------------------------------------

I don't get where fma is coming into this. Nothing of the sort is mentioned in 
our source algorithms. The name is also incorrect. The {{fusedMultiplyAdd}} 
operation is part of the IEEE 754 standard and is definitely not what is 
implemented here. In addition, this design has performance implications, 
especially for simple addition (see below comparison with the implementation in 
my draft PR).

||Benchmark||(c)||(size)||Mode||Cnt||Score||Error||Units||
|SumPerformance.fmaSum|1e20|1000|avgt|5|58292.678|± 7177.043|ns/op|
|SumPerformance.fmaSumOfProducts|1e20|1000|avgt|5|37880.075|± 1680.896|ns/op|
|SumPerformance.sum|1e20|1000|avgt|5|16214.321|±  159.853|ns/op|
|SumPerformance.sumOfProducts|1e20|1000|avgt|5|30733.531|±  330.481|ns/op|

> Summation and LinearCombination Accumulators
> --------------------------------------------
>
>                 Key: NUMBERS-163
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-163
>             Project: Commons Numbers
>          Issue Type: New Feature
>            Reporter: Matt Juntunen
>            Priority: Major
>         Attachments: FMA.java, Sum.java
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> It would be useful to have simple accumulator classes in {{Summation}} and 
> {{LinearCombination}} to perform extended precision operations on arbitrary 
> collections of values without requiring conversion to {{double[]}}. Ex:
> {code:java}
> Summation.Accumulator sum= Summation.accumulator(1d);
> sum.add(x)
>     .add(y)
>     .add(z)
>    .add(w);
> double sumResult = sum.get();
> LinearCombination.Accumulator comb = LinearCombination.accumulator(1d);
> comb.add(x, scale)
>     .add(y, scale)
>     .add(z, scale)
>     .add(w, scale);
> double combResult = comb.get();
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to