Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
2 votes
1 answer
94 views

I'm migrating my project from .NET Framework 4.7.2 to .NET 9.0. Now I see that casting a negative double to uint is different. .NET Framework 4.7.2: double codeDouble = -2147287039.0; uint codeUint = (...
0 votes
0 answers
29 views

Given a number with a width of n bits representing a signed number in two's complement, what is the minimal number of bits that need to be checked and which ones, in order to know whether there will ...
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; ...
2 votes
3 answers
298 views

When somebody says a number is represented as two's complement is it safe to write code that will represent the value in a signed integer? Does it depend on the CPU? how does c compiler handle ...
0 votes
2 answers
157 views

I'm reading The C Programming Language by K & R 2nd edition and got to the bitwise operators. Why, on C, the Complement (~) Operator applied to a N number, returns -(N + 1) ? When it normally just ...
-1 votes
1 answer
54 views

Is there a way to make Python interpret ~3 as an unsigned integer?
3 votes
1 answer
162 views

std::atomic::fetch_add() (or atomic_fetch_add() in C11) is based on two's complement for operations on signed integers. This is a different convention from the usual signed integer arithmetic, in ...
1 vote
1 answer
160 views

I'm very new to assembly so I don't know if this is a stupid question, but I have a question where I'm being asked to read the following line of assembly and say what value is stored in %rdi ...
0 votes
4 answers
197 views

How could I implement signed and unsigned multiplication of two 64 bit numbers, widened into 128 bits, and discarding the low 64 bits, returning the high 64 bits? The multiplication must properly wrap ...
l-m's user avatar
  • 5
0 votes
0 answers
48 views

I am trying to add two hex numbers given in two's compliment: A415 + A555. I'm having a bit of trouble with understanding the two's compliment inversion for adding. I converted both numbers to binary ...
0 votes
1 answer
430 views

I'm reading a textbook on systems programming and it states that an overflow occurs for unsigned integers if and only if the carry-in bit is mismatched with the carry-out, in the left-most bit. So if ...
4 votes
2 answers
112 views

#include <stdio.h> #include <stdint.h> int main() { uint16_t peter = 8; uint32_t peter2 = 8; if(peter > -1) { printf("Peter true\n"); //expected } ...
Niclas's user avatar
  • 269
0 votes
1 answer
893 views

I am in the process of learning C/C++, so for some this might be a basic question but it is confusing to me. Beautiful answers are given here related to how we interpret positive and negative numbers ...
0 votes
1 answer
115 views

So for my college computing course(UK), we were assigned a homework task to change a user's input to its negative equivalent (1 to -1, 13 to -13 etc...) but I cant figure out how to do it. I've got ...
-1 votes
2 answers
124 views

i have a question about relational operators are they always give correct results ? because if we run this line of code it will result 1 instead of 0 cout<<(ULLONG_MAX==-1); and if we keep ...

15 30 50 per page
1
2 3 4 5
...
47

AltStyle によって変換されたページ (->オリジナル) /