[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #57926] Error dividing uint64 uint32 uint16 ui
From: |
Mike Miller |
Subject: |
[Octave-bug-tracker] [bug #57926] Error dividing uint64 uint32 uint16 uint8 variables |
Date: |
Sat, 29 Feb 2020 15:12:16 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36 |
Update of bug #57926 (project octave):
Status: None => Invalid
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #1:
By default, integer division follows the same rounding rules as double
precision division, rounding up when the fractional part is 0.5 or greater.
This is correct and compatible behavior with Matlab.
The right way to get integer division with rounding towards zero is to use the
'idivide' function, for example
>> idivide (uint64(65535), uint64(2))
ans = 32767
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?57926>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/