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

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

[Octave-bug-tracker] [bug #50238] Functions "sum" & "cumsum" handle data


From: anonymous
Subject: [Octave-bug-tracker] [bug #50238] Functions "sum" & "cumsum" handle data types differently than "+" operator
Date: Mon, 6 Feb 2017 12:08:58 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko

URL:
  <http://savannah.gnu.org/bugs/?50238>

                 Summary: Functions "sum" & "cumsum" handle data types
differently than "+" operator
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Mon 06 Feb 2017 12:08:57 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Luke Trowbridge
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.0
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

I execute the following code:


a = uint8([150 150]);

% Calulate sum
s1 = sum(a);
s2 = a(1) + a(2);

% Calculate cumulative sum
cs1 = cumsum(a);
cs2(1) = a(1);
cs2(2) = a(1) + a(2);


and I get the following output:

s1 =  300
s2 = 255
cs1 =

   150   300

cs2 =

  150  255




I expected s1 to be equivalent to s2, and cs1 to be equivalent to cs2.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?50238>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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