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

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

[Octave-bug-tracker] [bug #56884] mean can overflow


From: Marco Caliari
Subject: [Octave-bug-tracker] [bug #56884] mean can overflow
Date: Thu, 12 Sep 2019 05:07:24 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0

URL:
  <https://savannah.gnu.org/bugs/?56884>

                 Summary: mean can overflow
                 Project: GNU Octave
            Submitted by: caliari
            Submitted on: Thu 12 Sep 2019 09:07:22 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Inaccurate Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

The function mean can overflow


> mean([1.7e308,1.5e308])
ans =  Inf


even if the result is clearly 1.6e308. It appear to me that the simplest
solution is to replace


y = sum (x, dim) / n;


with


y = sum (x / n, dim);


around line 153 of mean.m. By the way, matlab overflows too.





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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