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
13
votes
4 answers

Assigning a value to long data type in java - defaulting to int

long val = 5000000000; The error during this assignment is: The literal 5000000000 of type int is out of range Why does the compiler by default assume the literal to be type int when it is declared with type long?
Aarish Ramesh
  • 6,745
  • 15
  • 60
  • 105
13
votes
1 answer

Returning from __len__() when >64 bits

In this problem, I'm dealing with IPv6 network address spaces, so the length is 2^(128-subnet). It appears that python (at least on this machine), will cope with up to a 64 bit signed number as the return value from __len__(). So…
Jeff Ferland
  • 17,832
  • 7
  • 46
  • 76
13
votes
4 answers

Efficiency of different integer sizes on a 64-bit CPU

In a 64-bit CPU, if the int is 32 bits whereas the long is 64 bits, would the long be more efficient than the int?
12
votes
5 answers

How could I convert a 64-width binary string to long in Java?

I want to convert a 64-width binary string to long, there is a static method: Long.parseLong(String s, int radix) to do this, but it isn't suitable for my case. The problem is my binary string is a machine-style long int. For…
Sefier Tang
  • 770
  • 3
  • 8
  • 25
12
votes
5 answers

C#: How to convert long to ulong

If i try with BitConverter,it requires a byte array and i don't have that.I have a Int32 and i want to convert it to UInt32. In C++ there was no problem with that.
Ivan Prodanov
  • 34,634
  • 78
  • 176
  • 248
12
votes
3 answers

How to convert two longs to a byte array = how to convert UUID to byte array?

I am using Javas UUID and need to convert a UUID to a byte Array. Strangely the UUID Class does not provide a "toBytes()" method. I already found out about the two methods: UUID.getMostSignificantBits() and UUID.getLeasSignificantBits() But how to…
jens
  • 16,455
  • 4
  • 21
  • 20
12
votes
2 answers

Handling of integer with values > 2^32 on Sparc 32 bits

I coded a little program that measures the time spent into a loop (via an inline Sparc assembly code snippet). Everything is right until I set number of iterations above roughly 4.0+9 (above 2^32). Here's the code snippet : #include…
user1773603
12
votes
6 answers

Python: Is there a way to keep an automatic conversion from int to long int from happening?

Consider the example: >>> from sys import maxint >>> type(maxint) >>> print maxint 9223372036854775807 >>> type(maxint+2) >>> print maxint+2 9223372036854775809 >>> type((maxint+2)+maxint) >>> print…
dawg
  • 98,345
  • 23
  • 131
  • 206
12
votes
1 answer

IEEE-754 double (64-bit floating point) vs. long (64-bit integer) revisited

I'm revisiting a question (How to test if numeric conversion will change value?) that as far as I was concerned was fully solved. The problem was to detect when a particular numeric value would overflow JavaScript's IEEE-754 Number type. The…
mckamey
  • 17,359
  • 16
  • 83
  • 116
12
votes
6 answers

Difference between LongInt and Integer, LongWord and Cardinal

In Delphi, what is the difference between LongInt and Integer, LongWord and Cardinal ? and sometimes I find the usage of DWORD, what is it? Are they consistent in all versions of Delphi? which one should I stick to?
justyy
  • 5,831
  • 4
  • 40
  • 73
12
votes
2 answers

declaring long[] array in java

Can anyone tell me why cant i declare array like this? long[] powers = { 0, 0, 1, 7, 35, 155, 651, 2667, 10795, 43435, 174251, 698027, 2794155, 11180715, 44731051, 178940587, 715795115, 2863245995, 11453115051,…
Yetti
  • 327
  • 1
  • 4
  • 17
12
votes
3 answers

Making 'long' 4 bytes in gcc on a 64-bit Linux machine

I am working on porting an application to 64-bit on Linux platform. The application is currently supported on Linux, Windows, Mac 32-bit and Windows 64-bit. One of the issues we are frequently encountering is the usage of long for int and vice…
Chethan Ravindranath
  • 2,001
  • 2
  • 16
  • 28
12
votes
4 answers

Java JUnit assertEquals with Long

assertEquals( new Long(42681241600) , new Long(42681241600) ); I am try to check two long numbers but when i try to compile this i get integer number too large: 42681241600 error. Documentation shows there is a Long,Long assertEquals…
Hamza Yerlikaya
  • 49,047
  • 44
  • 147
  • 241
11
votes
4 answers

How to get the maximum number of a particular length

I have a number, for example 1234567897865; how do I max it out and create 99999999999999 ? I did this this way: int len = ItemNo.ToString().Length; String maxNumString = ""; for (int i = 0; i < len; i++) { …
Andrew
  • 7,619
  • 13
  • 63
  • 117
11
votes
7 answers

Why do C compilers specify long to be 32-bit and long long to be 64-bit?

Wouldn't it have made more sense to make long 64-bit and reserve long long until 128-bit numbers become a reality?
sj755
  • 3,944
  • 14
  • 59
  • 79