unsigned-integer Questions
3
Solved
I'm having the strangest issue today. I was working with an example online, and to my lack of surprise, it didn't work (they pretty much never do). I went about fixing it myself, but I seem to be s...
Flyover asked 2/4, 2015 at 16:9
2
Solved
I wanted to see what was happening behind the scenes when an unsigned long long was assigned the value of an unsigned int. I made a simple C++ program to try it out and moved all the io out of main...
Redman asked 28/1, 2015 at 15:48
3
Suppose I enter:
a = uint8(200)
a*2
Then the result is 400, and it is recast to be of type uint16.
However:
a = array([200],dtype=uint8)
a*2
and the result is
array([144], dtype=uint8)
Th...
Crassulaceous asked 5/1, 2015 at 13:46
2
Solved
Consider the following†:
size_t r = 0;
r--;
const bool result = (r == -1);
Does the comparison whose result initialises result have well-defined behaviour?
And is its result true, as I'd ...
Codex asked 10/12, 2014 at 15:58
5
Solved
Here is the example:
#include <stdio.h>
int main()
{
int x=35;
int y=-35;
unsigned int z=35;
unsigned int p=-35;
signed int q=-35;
printf("Int(35d)=%d\n\
Int(-35d)=%d\n\
UInt(35u)=%u\...
Boeschen asked 31/10, 2014 at 10:57
4
Solved
The new C++ standard still refuses to specify the binary representation of integer types. Is this because there are real-world implementations of C++ that don't use 2's complement arithmetic? I fin...
Yerga asked 13/4, 2011 at 18:59
1
I'm reading the standard and trying to figure out why this code won't be resolved without a cast.
void foo(char c) { }
// Way bigger than char
void foo(unsigned long int) { }
int main()
{
foo(...
Goebbels asked 24/9, 2014 at 7:16
3
Solved
I'm following the Java tutorial on Primitive Data Types. Early on, it states that
In Java SE 8 and later, you can use the int data type to represent an unsigned 32-bit integer, which has a minim...
Misfire asked 25/7, 2014 at 20:47
3
Solved
I am using SQL SERVER 2008, I have a number of INT, SMALLINT fields in my various tables, And I know they all will be 0 or greater than 0 i.e. I can take them Unsigned.
Is there a simple way of cr...
Subdue asked 1/9, 2011 at 7:31
4
Solved
Why are unsigned integers not CLS compliant?
I am starting to think the type specification is just for performance and not for correctness.
Strategist asked 8/8, 2008 at 19:55
3
Could anyone tell me please what is an efficient algorithm to count the number of leading zeroes in a 32-bit unsigned integer in C programming?
Claar asked 25/5, 2014 at 14:57
1
Using System.Data.SQLite, I am creating a table with unsigned integer columns:
@"CREATE TABLE widgets (" +
@"id unsigned integer(10) PRIMARY KEY, " +
@"fkey unsigned integer(10), " + ...
and t...
Corsair asked 18/11, 2013 at 12:15
3
Solved
I'm trying to use unsigned integers in VHDL with well defined bit widths. It seems VHDL does not like me trying to assign literal values to these types defined as:
variable LCD_DATA: unsigned(19 d...
Unsure asked 18/3, 2014 at 6:1
3
Solved
So here's the code:
int create_mask(unsigned b, unsigned e)
{
unsigned int mask=1;
if(b<e || b<0 || e<0)
{
printf("Wrong values, starting bit can't be smaller than ending.\n");
prin...
Grommet asked 2/9, 2013 at 13:54
2
Solved
This is a follow-up to this question.
(Why / When) Is it preferable to use Py_ssize_t for indexing? In the docs I just found
# Purists could use "Py_ssize_t" which is the proper Python type for
...
Kalisz asked 8/1, 2014 at 5:2
3
I need to build a function that returns the bit-level equivalent of (float)x without using any floating data types, operations or constants. I think I have it, but when I run the test file, it retu...
Anticipative asked 22/10, 2013 at 22:14
4
Solved
#include <stdio.h>
int main(void)
{
unsigned int a = 6;
int b = -20;
a + b > 6 ? puts("> 6") : puts("<= 6");
}
It is clear to me how the ternary operator wo...
Ideal asked 18/10, 2013 at 10:2
3
Solved
I understand that, regarding implicit conversions, if we have an unsigned type operand and a signed type operand, and the type of the unsigned operand is the same as (or larger) than the type of th...
Benildis asked 24/7, 2013 at 11:33
2
Solved
I have a question about unsigned ints.
I would like to convert my unsigned int into a char array. For that I use itoa. The problem is that itoa works properly with ints, but not with unsigned int (...
Allsun asked 16/6, 2013 at 10:40
2
Solved
#include <iostream>
int main ()
{
using namespace std;
unsigned int i = 4;
int a = -40;
cout<<a+i<<endl;
return 0;
}
Executing this gives me 4294967260
I know there'...
Hashim asked 24/5, 2013 at 5:36
9
While i am running the program below it outputs like 109876543210-1-2-3-4-5-6-78-9-10-11-12-and s0 on. Why so? What is the concept of unsigned integer?
main ()
{
unsigned int i;
for (i =...
Aegina asked 11/3, 2013 at 13:55
2
Solved
Im preparing for a very tricky c# exam and this question popped up while doing so.
I have the following code:
uint zzz = -12u;
-12u is recognized as System.Uint32 literal but it can only be sto...
Avram asked 4/12, 2012 at 15:7
1
When an integer number is out of the type's range, the max value + 1 is added / subtracted (depends on which part of the range the number was).
For example,
unsigned short num = 65537;
num will...
Woken asked 15/7, 2012 at 8:31
4
Solved
According to this SO post:
What is the size of an enum in C?
enum types have signed int type.
I would like to convert an enum definition from signed int to unsigned int.
For example, on my plat...
Elisaelisabet asked 3/7, 2012 at 15:44
3
Solved
As the question title reads, assigning 2^31 to a signed and unsigned 32-bit integer variable gives an unexpected result.
Here is the short program (in C++), which I made to see what's going on:
#...
Slipknot asked 2/4, 2012 at 8:48
© 2022 - 2024 — McMap. All rights reserved.