Skip to main content
0 votes
0 answers
90 views

I'm trying to detect if there is unsigned overflow when adding the 2's complement representation of 2 signed integers (using a custom SignedInteger class that wraps modulo 2**bits if the value leaves ...
nonhuman's user avatar
  • 141
5 votes
2 answers
177 views

Why C# checked keyword does not treat -1 - int.MinValue as overflow? int x = int.MinValue; int y; checked { // Overflow. 2^31 cannot be represented in signed integer. try { y = -x; } catch (...
Jatin Sanghvi's user avatar
4 votes
2 answers
183 views

I'm seeing a strange (to me) difference in behavior between Clang and GCC when comparing an integer with its negation. Also, pre-v12 GCC behaves like Clang. Code is below, but also here's a live link ...
jwd's user avatar
  • 11.4k
4 votes
2 answers
106 views

So, I'm experimenting with pandas with the IMDB files, especially title.basic.tsv. When trying to parse the runtimeMinutes column to "Int64", I get an error ValueError: Unable to parse ...
red_trumpet's user avatar
6 votes
4 answers
357 views

For example, if I want to add two unsigned 8-bit integers together, I know I will need to store the result in a 16-bit integer. Otherwise, I run the risk of overflowing. This problem gets more ...
Joseph's user avatar
  • 61
3 votes
4 answers
336 views

I have an array of the form a = np.array([1], dtype='uint8'). Now if I add 255 to a it will overflow and be np.array([0]). Is there a built-in way to "clip" to value to 255? NumPy has the ...
cards's user avatar
  • 5,280
1 vote
1 answer
61 views

I have this program that is supposed to select one color channel from an image, and square each element elementwise. However, it is not returning any results greater than the values in the first array?...
Gad11ng's user avatar
  • 43
0 votes
1 answer
73 views

I'm using InferSharp to analyze a compiled .NET 6.0 C# project for potential issues. However, it does not detect a buffer overrun in the following code: namespace Buffer_overflow { public class ...
ULF21's user avatar
  • 1
4 votes
3 answers
187 views

My platform is x86_64, and assume there are 3 variables whose types are all uint16_t: uint16_t a, b, c; And for the following two code snippets: (1) uint16_t tmp = b - a; uint16_t result1 = c - tmp; ...
Nan Xiao's user avatar
  • 17.7k
2 votes
3 answers
120 views

Context: I want to verify the fact that under 32-bits, Ox8000 0000 - 1 = Ox7FFF FFFF, so if both of them are interpreted as signed integers, the sign will change from negative to positive. Here goes ...
Ning's user avatar
  • 23
0 votes
0 answers
409 views

I am currently using an open source Python package called snompy (https://github.com/TomVincentUK/snompy). While implementing the package, a function that defines the transfer matrix returns an ...
Ilario Bisignano's user avatar
0 votes
0 answers
62 views

According to the C standard, signed integer overflow is undefined behavior. Fortran integers are signed integers. Does the Fortran standard mandate how overflow should be treated? In practice it seems ...
M0M0's user avatar
  • 236
-3 votes
2 answers
119 views

I want to understand more about int overflow in C++ on a 64-bit system. So I would like to stick to int for my understanding without casting / extending the type to unsigned or 64-bit and I am on ...
khteh's user avatar
  • 4,280
0 votes
5 answers
177 views

int sum = x+y; sum-x == y; If sum overflows, then sum-x will not be equal to y and overflow is detected. But if sum has not overflowed, then sum-x==y is equal to y. Then why is this logic not used? ...
Shiva kumar das's user avatar
0 votes
1 answer
133 views

I'm wondering if it is allowed in C++ to use overflow on purpose. In specific I want to increase a counter every cycle and when uint32_max is reached start from 0. In my mind the easy way would be: ...
gnicki's user avatar
  • 83

15 30 50 per page
1
2 3 4 5
76