Questions tagged [long-integer]

A long integer is an integer number, typically twice the size of a standard integer. It is represented by the keyword 'long' in several programming languages.

A long integer is an integer number, typically twice the size of a standard integer. It is represented by the keyword 'long' in several programming languages.

http://en.wikipedia.org/wiki/Integer_(computer_science)#Long_integer

2408 questions
10
votes
4 answers

How to convert 'unsigned long' to string in java

it is clear that java does not have 'unsigned long' type, while we can use long to store a unsigned data. Then how can I convert it to a String or just print it in a 'unsigned' manner?
Shawn
  • 1,441
  • 4
  • 22
  • 36
9
votes
4 answers

Long + Long not bigger than Long.MAX_VALUE

If I have an assignment Long c = a + b; Is there an easy way to check that a + b is not bigger/smaller than Long.MAX_VALUE/Long.MIN_VALUE?
Kaur Kase
  • 126
  • 1
  • 7
9
votes
4 answers

What is the largest data type for storing (and printing) an integer?

In C on a 32-bit system, which data type will store (and can therefore print) the largest integer? Is it long long or unsigned long? Is there an unsigned long long? And which is the most precise and politically correct?
camel-man
  • 317
  • 1
  • 2
  • 9
9
votes
5 answers

Why is (long)9223372036854665200d giving me 9223372036854665216?

I know about weird stuff with precision errors, but I can't fathom, Why is (long)9223372036854665200d giving me 9223372036854665216 ?
Pacerier
  • 86,231
  • 106
  • 366
  • 634
9
votes
4 answers

How to tell if a MySQL process is stuck?

I have a long-running process in MySQL. It has been running for a week. There is one other connection, to a replication master, but I have halted slave processing so there's effectively nothing else going on. How can I tell if this process is…
user87843
  • 91
  • 1
  • 1
  • 2
9
votes
3 answers

Exception in thread "main" java.lang.NumberFormatException: For input string: "9000000000000000" under radix 16

I try to run this code but it occur error. System.out.println(Long.parseLong("9000000000000000", 16)); As we know that the minimum number of long is -9,223,372,036,854,775,808 and 0x9000000000000000 is -8,070,450,532,247,928,832 why it will occur…
Moly Holy
  • 133
  • 1
  • 9
9
votes
5 answers

(a * b) / c MulDiv and dealing with overflow from intermediate multiplication

I need to do the following arithmetic: long a,b,c; long result = a*b/c; While the result is guaranteed to fit in long, the multiplication is not, so it can overflow. I tried to do it step by step (first multiply and then divide) while dealing with…
MagicKriss
  • 150
  • 13
9
votes
3 answers

java: Long.parseLong(s,16) and Long.toHexString(l) not inverses?

I get this but yet I don't get it: package com.example.bugs; public class ParseLongTest { public static void main(String[] args) { long l = -1; String s = Long.toHexString(l); System.out.println(s); long l2 =…
Jason S
  • 184,598
  • 164
  • 608
  • 970
9
votes
1 answer

"Overflow" compiler error with -9223372036854775808L

The range of the Long data type is -9223372036854775808 to 9223372036854775807, but the following statement generates compiler error "BC30036: Overflow": Dim a As Long = -9223372036854775808L Try it online! Why is this an error? How can I specify…
Anurag Rao
  • 107
  • 2
9
votes
3 answers

Different implementations of compare method for Long, Integer and Short?

Why are the implementations of the static method compare for Long, Integer and Short in Java's library different? For Long: public static int compare(long x, long y) { return (x < y) ? -1 : ((x == y) ? 0 : 1); } For Integer: public static int…
fluency03
  • 2,637
  • 7
  • 32
  • 62
9
votes
7 answers

Using std::chrono::duration::rep with printf in 32bit and 64bit programs

There is this code: #include #include int main() { auto d = std::chrono::microseconds(1).count(); printf("%lld", d); return 0; } When this is compiled in 64bit mode, then there is a warning: main.cpp: In function ‘int…
wulujey
  • 384
  • 1
  • 2
  • 9
9
votes
2 answers

C++ literal integer type

Do literal expressions have types too ? long long int a = 2147483647+1 ; long long int b = 2147483648+1 ; std::cout << a << ',' << b ; // -2147483648,2147483649
Abhinav Vishak
  • 361
  • 1
  • 5
  • 17
9
votes
1 answer

How to get Windows window names with ctypes in python

I try to get Windows window title names and pids through handles with long objects. My code works but there is something wrong with it. I get only 4 window titles when I should get 10 or more. Can anyone help and tell me how to fix this code? I…
Gunnm
  • 974
  • 3
  • 10
  • 21
9
votes
3 answers

Are there uint64 literals in Go?

I'm looking at the numeric types in Go. I want to use uint64 literals. Is this possible in Go? Here's an example of how I'd like to use uint64 literals: for i := 2; i <= k; i += 1 { // I want i to be a uint64 ... }
user3835277
9
votes
3 answers

How is 64-bit math accomplished on a 32-bit machine?

If a 32-bit processor is, indeed, really only 32 bits in length, then how can math operations work on 64-bit numbers? For example: long lngTemp1 = 123456789123; long lngTemp2 = lngTemp1 * 123; According to MSDN, a long in C# is a signed 64-bit…
Icemanind
  • 47,519
  • 50
  • 171
  • 296