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.

long-integer
Filter by
Sorted by
Tagged with
-1 votes
2 answers
2k views

Long.valueOf not compiling for converting int to long

Looking at the answers to this question (link: How do I convert from int to Long in Java?), I used the following to compare long values (newUpdate, lastUpdate) with int value (Interval) if ((...
RedDopamine's user avatar
58 votes
2 answers
90k views

What happens when I assign long int to int in C?

In a recent homework assignment I've been told to use long variable to store a result, since it may be a big number. I decided to check will it really matter for me, on my system (intel core i5/64-...
Khaloymes's user avatar
  • 759
0 votes
1 answer
57 views

Associate File Extension with Application fail with long file names

I have a project that is named : "Testing results". It generates a executable "Testing results". If I try to setup my info.plist file to have an association with files received by mail, the mail ...
araferna's user avatar
104 votes
5 answers
191k views

Definition of int64_t

I am new to C/C++, so I have a couple of questions about a basic type: a) Can you explain to me the difference between int64_t and long (long int)? In my understanding, both are 64 bit integers. Is ...
clstaudt's user avatar
  • 22k
3 votes
2 answers
462 views

Does Java bitwise representation of long vary?

I would like to fill a Java array of longs, so that all of its bits are set to 1. I've found out that the corresponding long value is -1, or "0xFFFFFFFFFFFFFFFFl": long l = -1L; System.out.println(...
Adam Matan's user avatar
  • 133k
4 votes
3 answers
5k views

Accessing the highest digits of large numbers from Python long

I'm working with numbers with tens of thousands of digits in python. The long type works beautifully in performing math on these numbers, however I'm unable to access the highest digits of these ...
Adam Cadien's user avatar
  • 1,157
1 vote
3 answers
619 views

Warnings to determine unsafe casts clang

I am working on porting a legacy application to 64-bit on Linux. There are lots of places where long and int are used interchangeably and the source code being reasonably large makes it difficult to ...
Chethan Ravindranath's user avatar
3 votes
1 answer
5k views

Objective-C (iOS) : NSData to long long value?

I'm sending a 8 bytes numeric value over the network (from a c# windows server) that needs to be received by my iDevice. The value is a "long" variable on my server (System.Int64). I checked that the ...
user1838920's user avatar
5 votes
2 answers
303 views

Is it not guaranteed that long or long long can store greater numbers than int?

In my assignment, it says Do not add long int or long long private members to accomplish this as there is no guarantee that either can actually store larger numbers than an int. I know that int has ...
user44322's user avatar
  • 361
0 votes
3 answers
1k views

Division of a long long C type

I need to use the 'long long' c type, to store data in a very large array. Since my code is large, I made up this fairly simple code which has the same problem. So, it iterates 222 times in the loop, ...
Anoracx's user avatar
  • 438
-2 votes
1 answer
249 views

Why use int ever again? [closed]

We are all nearly on 64bit machines and JVMs, RAM is cheap and performance rarely centers around low level JVM issues. So why doesn't everyone STOP using int and move entirely to 64bit longs both in ...
user1016765's user avatar
  • 2,984
-1 votes
1 answer
417 views

can't subtract long double form long double in C++

Whenever I do subtraction from long double, I get incorrect answer long double Runge(long double a, long double b, int m) { long double R; R=(b-a)/((2^m)-1); cout<<setprecision(16)<<R<&...
QED's user avatar
  • 77
0 votes
2 answers
313 views

Using Long Integer types with collection methods

I've encountered a problem, which is best illustrated with this code segment: public static void Foo(long RemoveLocation) { // Code body here... // MyList is a List type collection object. ...
kevin628's user avatar
  • 3,488
0 votes
1 answer
107 views

Long Linked List

How would I go to create a long using a single linked list? I need to get started but I dont know how. Is it possible that someone can show me how to get the basic BigInt?
user1775641's user avatar
1 vote
1 answer
662 views

Long-double-linked-list

I have a problem with the code. The code gives an error and it says that Node does not have a "previous" in the __add__() operator however it doesnt give an error in the main program The point of the ...
user1775641's user avatar
4 votes
5 answers
1k views

Factorial function produces wrong result for 21! and above

for (int i = 0; i <= 25; i++) System.out.printf("%d! = %,d\n", i, factorial(i)); The code above initializes the factorial method below: public static long factorial(int num1) { if (num1 =...
Matt Andrzejczuk's user avatar
1 vote
2 answers
92 views

LongToByte and LongFromByte

I have the two functions shown below which I built for serialisation of long and byte[] values. public static byte[] LongToByte(long Value) { byte[] Output = new byte[8]; ...
Matthew Dunn's user avatar
0 votes
2 answers
170 views

How i can get max value of this increment?

I have increment syntax, and i want to save the last maximum value , so when i close my program and open it again , the increment will start from the last maximum value not start from 0 again .. but ...
Ayharu's user avatar
  • 109
8 votes
2 answers
9k views

How to convert long-integer time to NSString or NSDate to display time?

I got a serial number form Java Date which convert into long-integer such as "1352101337000". The problem I met is how to analyze this long-integer number back to NSDate or NSString so that I can ...
Lothario's user avatar
  • 300
3 votes
2 answers
1k views

Trouble with printf conversion long long

I've been working on a project euler problem, which by their very nature coerce you to use data types with big storage. #include <stdio.h> #include <conio.h> #define num 600851475143 int ...
user1794004's user avatar
30 votes
6 answers
36k views

Difference between Long.valueOf(java.lang.String) and new Long(java.lang.String)?

I'm consolidating code written by two different people and notice that casting a String value into a Long has been done in two different ways. Coder #1 has done this: String strId = "12345678"; ......
AWT's user avatar
  • 3,667
0 votes
3 answers
431 views

java long datatype conversion to unsigned value

I'm porting some C++ code to Java code. There is no unsigned datatype in java which can hold 64 bits. I have a hashcode which is stored in Java's long datatype (which of course is signed). long ...
user982845's user avatar
2 votes
7 answers
13k views

Convert String (representing decimal number) to long

I've googled around a bit but could not find examples to find a solution. Here is my problem: String s = "100.000"; long l = Long.parseLong(s); The 2nd line of code which tries to parse the string '...
temelm's user avatar
  • 778
1 vote
1 answer
496 views

jmap and object size

I run jmap on my JVM to try to understand some memory leaks and I discovered something strange : the java.lang.Long use 24 bytes instead of 8 !!! Can some tell me where is my mistake ? num #...
Ektor's user avatar
  • 163
1 vote
1 answer
113 views

Converting to long and validate

I have a Facelets page with a form with ICEfaces components. empId is a long type property, which has to be checked if null or not in the bean. It is taken as String in the form, and I am converting ...
user1765427's user avatar
3 votes
2 answers
241 views

C double limitations in python

I know python is capable of handling arbitrary big integers, so why doesn't it give me one when using scientific notation? Why is 1e23 any different from 10**23? Python 2.7.3 (default, Aug 1 2012, ...
wim's user avatar
  • 350k
1 vote
2 answers
1k views

C long unsigned int number manipulation

I am trying to do some simple variable manipulation in a embedded C/C++ environment. For some reason I consistently am getting zeros as a result. Here is the code void Heater::setPower( int newpower ...
napierzaza's user avatar
182 votes
11 answers
461k views

How to implement infinity in Java?

Does Java have anything to represent infinity for every numerical data type? How is it implemented such that I can do mathematical operations with it? E.g. int myInf = infinity; //However it is done ...
user1753100's user avatar
  • 1,959
1 vote
1 answer
2k views

How to convert array of char to variable long in C?

I have been trying for hours to convert this. I have tried looping through the array casting the chars to longs, but that wouldn't work. I have seen simple examples online, but they don't cover a ...
CS Gamer's user avatar
  • 235
5 votes
2 answers
5k views

Python MySQLdb converters isn't working

I'm trying to run an ETL script using python and MySQLdb but I'm stuck with the results from my initial extract query. The types returned are all Long and Decimal when I want Int and Float. I've ...
user1747503's user avatar
1 vote
1 answer
563 views

http-long polling and -streaming: send data on same connection?

Just another quick question of understanding here... I'm wondering, while an HTTP request from a client is pending on the server when using long-polling or http-streaming, is it possible for the ...
slagjoeyoco's user avatar
0 votes
1 answer
644 views

long polling doesn't stop

I tried to modified the long polling code to fit my situation. I would like to count the total number from mysql and if the number changes (increase or decrease), it will notify me. The problem is ...
user1042911's user avatar
1 vote
3 answers
888 views

How to use String.format to convert a long to a String in currency format in Java

I need to learn how to convert a long value into a currency formatted string in a toString() method with the following scenarios: If given long value = 9287, needs to be displayed as $92.87 If given ...
user1741700's user avatar
2 votes
2 answers
104 views

What side-effects arise from setting a Long variable equal to False?

I am working on a piece of legacy code at work and I ran into a variable assignment that raises some questions for me. The variable PortOpen was declared with its type set as Long, and later in the ...
Tim's user avatar
  • 67
0 votes
4 answers
2k views

Add field for a 10 digit number in user registration form in Drupal 7

My user registration form has a field for contact number (mobile number) which is 10 digits long. I used a normal integer field which gives me "Out of range" error PDOException: SQLSTATE[22003]: ...
aayush shrestha's user avatar
0 votes
4 answers
3k views

Assigning Value to unsigned long long in C

While assigning value to a unsigned long long variable in C, value of variable is not getting assigned properly. The code is: #include <stdio.h> int main() { unsigned long long x; printf("%...
Rog Matthews's user avatar
  • 3,197
12 votes
3 answers
11k views

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 ...
Chethan Ravindranath's user avatar
1 vote
2 answers
339 views

In Python, how can I print a dictionary containing large numbers without an 'L' being inserted after the large numbers?

I have a dictionary as follows d={'apples':1349532000000, 'pears':1349532000000} Doing either str(d) or repr(d) results in the following output {'apples': 1349532000000L, 'pears': 1349532000000L} ...
Ben's user avatar
  • 2,343
37 votes
2 answers
7k views

Why do these two multiplication operations give different results?

Why do I need to add an "L" letter to get the correct long value? And what is the other value? long oneYearWithL = 1000*60*60*24*365L; long oneYearWithoutL = 1000*60*60*24*365; System.out.println(...
fareed's user avatar
  • 3,054
0 votes
2 answers
191 views

Porting '&' operator from Java to Javascript: Overflow issues

Consider the following JAVA statement: System.out.println(3232235776l & 0xFFFFFFFE); The output is: 3232235776 When I re-write the statement in JavaScript: console.log(3232235776 & ...
user avatar
0 votes
2 answers
2k views

Best way to handle long integers in a CSV file

I have a csv file with a column where the integers are over 16 characters long. The issue with this is that it changes the integer to a short abbreviation example: 8.71688E+17, is there a way in c# ...
Mark W's user avatar
  • 95
3 votes
3 answers
6k views

Why does built-in sum behave wrongly after "from numpy import *"?

I have some code like: import math, csv, sys, re, time, datetime, pickle, os, gzip from numpy import * x = [1, 2, 3, ... ] y = sum(x) The sum of the actual values in x is 2165496761, which is larger ...
notilas's user avatar
  • 2,383
3 votes
1 answer
1k views

Converting md5 to two long variables in Java

I'm trying to hash some values and use the hashed value as an index in my database. Not having collisions is very important, which is why I'm going with md5. Having 128 bits, gives me more than the ...
Roozbeh15's user avatar
  • 4,127
1 vote
8 answers
5k views

Long variable in C#, why does it return a negative value when it crosses the limits

I made an application to resolve the factorial and when I type a number longer than than 20 digits for a long variable , it returns a negative number. I want to know why a long variable in C# returns ...
Juan O.S.'s user avatar
5 votes
4 answers
14k views

NullPointerException using Long after equality check

This threw me. If you have a Java Long variable and you check equality against a primitive value using the == operator the runtime type of the value is changed to a primitive long. Subsequent ...
Rob Challen's user avatar
0 votes
5 answers
373 views

Why isn't long int 100% accurate?

I was trying out the time -p command on Linux and I wrote some code to waste CPU cycles: #include <iostream> using namespace std; int main() { long int c; long int ss; for(c = 0;c < ...
mimicocotopus's user avatar
1 vote
5 answers
1k views

Parsing long fails for large input in Java

I'm trying to read a very large input as String and then converting it into long as per follows:[The program works for short input] The input is two int separated by a space, example: "...
user188995's user avatar
6 votes
1 answer
1k views

MySQL very slow loop

I made a very simple procedure (a while loop) in MySQL: BEGIN DECLARE start INT; DECLARE ending INT; SET start = 1; SET ending = 4000000; WHILE (start <= ending) DO ...
recis's user avatar
  • 225
9 votes
1 answer
3k views

Android / Java: long gets negative without exceeding max_value

I'm trying to do some basic calculation stuff in my android app to compare a Date.getTime() value with some calculated stuff. The calculation I do during a database query is: long minus = pauseDays *...
user1515310's user avatar
4 votes
2 answers
2k views

Displaying long application name in iphone

I'm new to Iphone development. I've developed an application with Titanium Studio, but I have a long name for my application. When I deployed the application to device, I saw that the name was not ...
senthil's user avatar
  • 1,307

1
37 38
39
40 41
49