[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #61300] integer range might exceed upper limit
From: |
Arun Giridhar |
Subject: |
[Octave-bug-tracker] [bug #61300] integer range might exceed upper limit |
Date: |
Sun, 28 Nov 2021 14:56:37 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0 |
Follow-up Comment #23, bug #61300 (project octave):
Yes, you are right: the problem in the previous test (comment #21) was the
values were too close to intmax. Reducing the values seems to work better:
octave:1> uint64(0) : uint64(1e18) : uint64(1e19)
ans =
Columns 1 through 6:
0 1000000000000000000 2000000000000000000
3000000000000000000 4000000000000000000 5000000000000000000
Columns 7 through 11:
6000000000000000000 7000000000000000000 8000000000000000000
9000000000000000000 10000000000000000000
octave:2> int64(0) : int64(1e17) : int64(1e18)
ans =
Columns 1 through 6:
0 100000000000000000 200000000000000000
300000000000000000 400000000000000000 500000000000000000
Columns 7 through 11:
600000000000000000 700000000000000000 800000000000000000
900000000000000000 1000000000000000000
Converged patch:
diff -r 3c4639e42855 liboctave/array/Range.h
--- a/liboctave/array/Range.h Fri Nov 26 16:22:19 2021 -0800
+++ b/liboctave/array/Range.h Sun Nov 28 14:54:56 2021 -0500
@@ -325,8 +325,9 @@
m_numel = ((m_increment == T (0)
|| (m_limit > m_base && m_increment < T (0))
|| (m_limit < m_base && m_increment > T (0)))
- ? T (0)
- : (m_limit - m_base + m_increment) / m_increment);
+ ? 0
+ : (m_limit.value () - m_base.value () + m_increment.value
())
+ / m_increment.value ());
m_final = m_base + (m_numel - 1) * m_increment;
}
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?61300>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, (continued)
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Arun Giridhar, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Markus Mützel, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Arun Giridhar, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Arun Giridhar, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Arun Giridhar, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Arun Giridhar, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Markus Mützel, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Arun Giridhar, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Arun Giridhar, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Markus Mützel, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit,
Arun Giridhar <=
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Markus Mützel, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Arun Giridhar, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Arun Giridhar, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Arun Giridhar, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Arun Giridhar, 2021/11/28
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Markus Mützel, 2021/11/29
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Markus Mützel, 2021/11/29
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Arun Giridhar, 2021/11/29
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, John W. Eaton, 2021/11/29
- [Octave-bug-tracker] [bug #61300] integer range might exceed upper limit, Markus Mützel, 2021/11/29