Questions tagged [unsigned-long-long-int]

unsigned long long int specified in the C99 standard

unsigned long long long int is at least 64-bit in size and was specified in the C99 standard. It is the same as long long but unsigned.

162 questions
1
vote
3 answers

'unsigned long int', and 'unsigned long long int' assignment issue

A few weeks ago, I was using for first time (I'm not used to use them) floats, doubles, and I have some problems with the comparison operand. I also have had problems while trying to assign values to that types, but I've solved it as well... Today,…
shura-astrozero
  • 165
  • 2
  • 10
1
vote
4 answers

Is there a shorthand for the unsigned long long type?

The type: unsigned long long my_num; seems cumbersome. I seem to recall seeing a shorthand for it, something like: ull my_num; Am I going mad, or is there a simpler way of writing unsigned long long?
Connor
  • 867
  • 7
  • 18
1
vote
2 answers

warning: integer constant is too large for its type

how to find the correct type for largest number ? #include /** * factor_prime - prints the prime factors of a number * @n: number */ void factor_prime(unsigned long long n) { long i; long inter = n; printf("n : %lld\n",…
iamMAHAM
  • 68
  • 1
  • 7
1
vote
1 answer

Wrong result on modular arithmetic on ARM (Apple M1) with clang -O3 optimization

I am pulling my hair out for the last couple of days with this "innocuous" piece of code (minimal reproducible example, part of a larger modular multiplication routine): #include #include using ubigint = unsigned long long…
vsoftco
  • 55,410
  • 12
  • 139
  • 252
1
vote
1 answer

unexpected integer returned from a C function by calling it using ctypes

I wrote following C function: unsigned long long int myfunction(unsigned long long int number) { return number; } and after making a shared library I want to calling it from python: from pathlib import Path from ctypes import CDLL,…
d4riush
  • 370
  • 3
  • 8
1
vote
0 answers

Why %llu isn't recognized by gcc?

I'm trying to compile this simple code in Windows using MinGW-W64 #include #include int main () { printf("%llu\n", sizeof(unsigned int)*8); } but when i compile the output of gcc is this: llu.c: In…
1
vote
5 answers

How can one store a uint64_t in an array?

I am trying to store a uint64_t representation of a crc64 checksum as an array. The checksum will always be like uint64_t res = 0x72e3daa0aa188782, so the I want that to be stored as an array, char digest[8], where digest[0] is 72, digest[1] is…
1
vote
0 answers

Incorrect printf output when the arguments are large integers with a decimal point in the end

While writing a program I came across a case where a large integer with a decimal point at the end is printed with different values when casted with different data types. A minimal working example is #include int main(){ …
1
vote
1 answer

why it gives negative values when finding factorial in C?

I have to make a recursive function to find the factorials from 1 to 30. The factorial values are correct up to 12. And from 13, it gives wrong values and some of them are negative. I used "unsigned long long" but didn't work. I use codeblocks as…
1
vote
2 answers

C if condition comparing result of unsigned long bitwise operation with 0 is evaluated as false although true expected ( 0 == 0 is false)

versionNumberAndPlaceNumber being 0xFFFF00 the true case of the following if is not entered: if(versionNumberAndPlaceNumber & 0xFFUL == 0UL) { Why would this be? . Here follows a longer code excerpt: if(bytes_received == 27) { // the data…
1
vote
0 answers

Limitation of stoi, stol and stoll in convert string of largest size data type to int data type

We know stoi, stol and stoll are used to convert string data type to int data type. But what if the number is itself greater than pow(2,64). Is there any way or built function to convert the largest string to a number?
1
vote
1 answer

using ``1ll<<(N-1)`` to assign a large number of value to a long long int variable

The question I saw was stated: You are given an array A of size N. An element Ai is said to be charged if its value(Ai) is greater than or equal to Ki and Ki is the total number of subsets of the array A, that contains an element Ai. The logic is…
era s'q
  • 537
  • 1
  • 7
  • 27
1
vote
2 answers

how do I declare an integer variable of 1024 bits in length?

I'm trying to write an algorithm for a number theory/computer science merged class that can factor large numbers in better than exponential time. I am using the g++ compiler on a 64 bit machine but when I chain together long it will only allow me to…
user520621
1
vote
1 answer

Large Arithmetic by MinGW fails

My general task is to compute According to Wolfram, I expected the following to return the same: #include #include #include unsigned long long f(const std::vector &coefficients) { unsigned short exponent…
Mushroom Man
  • 400
  • 3
  • 18
1
vote
4 answers

Finding the last 10 digits of 2^n

So i'm supposed to find out the last 10 digits of 2^n(0<=n<=100) where n is the input. I found a method to handle large numbers but the program fails when n>64. Any leads on how to go about with this would be…
Reddy90
  • 79
  • 6