Re: Possible F77 Code Improvement ??



On Mar 4, 5:46 pm, Glen Herrmannsfeldt <g...@xxxxxxxxxxxxxxxx> wrote:
monir wrote:

(snip)

in order to minimize the round-off errors, sort

 > the absolute values in ascending order, and then
 > sum the actual values in the new order

I know that with one sign it is best to sort and add.

I am not so sure about mixed signs.  I can easily imagine
that a large value of the opposite sign at the end wipes
out all the previously minimized round-off errors.

-- glen

Glen;

I believe it is the subtraction of almost equal small values that can
seriously affect the precision of the calculations.
Routine sort2d is based on N.R. Heapsort method and has been tested
extensively in the summation of very large arrays of mixed elements
ranging from extremely large to extremely small values.

Regards.
Monir
.



Relevant Pages

  • Re: Is C close to the machine?
    ... If you're summing N (IEEE) floating point numbers, which order gives the least error? ... Is it in ascending order of absolute values? ...
    (comp.arch)
  • Re: Interesting Programming Problem
    ... it is better to sort in ascending order, ... 10 checks vs 17 (depending how you count) ... I do stop when the sum is too ...
    (microsoft.public.fox.programmer.exchange)
  • Help with Prob/stats question
    ... Choose N random integers from 1 to N, sort them in ascending order ... what is the expected value of the sum for all the slots of the absolute value of that difference. ...
    (sci.math)
  • Re: Pivot Table field selection order
    ... For some reason my Pivot Table Field List selection under "Choose ... add to report:" is sorted in ascending order and not in the order they ... Sum of 1 Apr 2009 ... opportunity to add attachmnets to your posts so you can add workbooks to ...
    (microsoft.public.excel.misc)
  • Re: Is C close to the machine?
    ... Is it in ascending order of absolute values? ... Why must you insist on performing sequential sums? ... array, the next to last to the second, and when the array is ...
    (comp.arch)