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

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

[Octave-bug-tracker] [bug #61143] Functions sum and mean returns wrong a


From: Dmitri A. Sergatskov
Subject: [Octave-bug-tracker] [bug #61143] Functions sum and mean returns wrong answer for single precision input
Date: Mon, 13 Sep 2021 04:39:41 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Follow-up Comment #21, bug #61143 (project octave):

I disagree with Kay. In Matlab's case The issue is presision; 
in octave case the issue is a broken algorithm. 



octave:2> (1e7 / 9999961 -1 )/ eps("single")
ans = 32.716                       # error in matlab's case
octave:3> x=single(0.1*ones(1e+8,1));
octave:4> sum(x)
ans = 2097152
octave:5> (1e7 / 2097152 -1 )/ eps("single")
ans = 3.1611e+07                   # error in Octave case

 

Dmitri.
-- 


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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