octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #61041] Sum behaves unexpectedly for large uin


From: Michael Leitner
Subject: [Octave-bug-tracker] [bug #61041] Sum behaves unexpectedly for large uint64 values when not using native mode
Date: Mon, 16 Aug 2021 16:54:03 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Firefox/60.0

Follow-up Comment #2, bug #61041 (project octave):

Only 90 eps for 88 million values is actually quite good. The point is that
during the computation of the sum, at some point the current partial sum
exceeds flintmax, meaning that not all integer can be exactly expressed any
more. Specifically, between flintmax and 2*flintmax only the even integers can
be expressed, and from 2*flintmax to 4*flintmax only the multiples of 4 (and
so on). Thus, once you are above flintmax each single addition will lead to an
error on the order of eps. Partially, these errors will cancel, but you can
expect the partial sum to perform something like Brownian motion relative to
the true partial sums. Try the option "extra" of the sum command, which
supposedly uses a more accurate summation algorithm (perhaps Kahan summation,
but not specified by the documentation). 

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61041>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]