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

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

[Octave-bug-tracker] [bug #57278] idivide with round case is incorrect w


From: Carnë Draug
Subject: [Octave-bug-tracker] [bug #57278] idivide with round case is incorrect when input are not integers
Date: Wed, 20 Nov 2019 10:56:56 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

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

                 Summary: idivide with round case is incorrect when input are
not integers
                 Project: GNU Octave
            Submitted by: carandraug
            Submitted on: Wed 20 Nov 2019 03:56:55 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

The idivide function performs integer division. Matlab requires the input
arguments to be of an integer type while Octave does not (although the
examples in Octave cast the input to integer).

In the case of the "round" method, if the input is not of an integer type,
Octave does not cast the return to an integer and the result is wrong:


octave> divide (5, int8 (2), "round")
ans = 3 # correct result
octave> idivide (5, 2, "round")
ans = 2.5000 # should return 3 (or error if input is not an integer)


See stackoverflow question
https://stackoverflow.com/questions/58939734/integer-division-in-octave/




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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