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
0
votes
2 answers

Long string in python3

I am tring to run the below code in python3 running on Centos8 namespace="abcnkabc51-admin-ns" podtype="smd" appPodName="smd-84b4bf8fcc" cmd_appNodeNames="kubectl get pod --show-labels -o wide -n "+namespace+"|egrep \"app="+podtype+"\" |grep…
Ashish
  • 27
  • 4
0
votes
2 answers

LeetCode 7: Reverse Integer | why does it work with a long but not with an int?

I was trying to solve this problem on LeetCode where you have to reverse an integer using a function. The constraint is that if the reversed number goes outside the signed 32-bit integer range, i.e. (-2^31) to (2^31 - 1) then you return 0. When I…
reek1729
  • 9
  • 1
0
votes
2 answers

Inversion count gives error on large inputs

The given code is for counting the inversions in the given array or we can say to count the number of changes to be made in an array so that it becomes sorted. Code is working fine for the inputs lower than 10**5 but above that it is giving error…
Harsh
  • 19
  • 4
0
votes
3 answers

Why casting a very large long number to int gives us a strange output (Java)?

I was practicing some castings in Java and I faced a situation for which I couldn't find any answers, anywhere. There are a lot of similar questions with answers, but none gave me an explanation for this particular case. When I do something like …
hsugui
  • 51
  • 5
0
votes
2 answers

From long to wide

I have some trouble converting my data.frame from long to wide. My data looks like this: Book Word Sentiment AAA word1 Fear AAA word2 Joy BBB word3 Trust BBB word4 Joy CCC word5 Trust CCC word6 Trust I…
Curiel
  • 39
  • 5
0
votes
1 answer

Perform XOR operation on 2 "Long" variables and display the alphanumeric result in .NET Core Console Application

I'm building a .NET Core console application in which I'm trying to perform an "XOR" operation on 2 "Long" datatype values. The result I want should be alphanumeric like "21341FAK234A213KR", but I'm getting results as integers. Perform XOR operation…
Kamran Bajwa
  • 39
  • 2
  • 10
0
votes
2 answers

Int multiplication with long result overflowing

I have some code on an embedded system (the MSP430FR5994, specifically) that multiplies a number. In this example I am multiplying 80 by 1159, though in my applications voltage_difference_range is usually around 1000. int…
HFOrangefish
  • 267
  • 1
  • 10
0
votes
1 answer

Java Long to int conversion skipping gaps between longs

I'm working on a school project where I'm building a geographical map from nodes. These nodes are loaded from an XML format from OpenStreetMap.org. There are a lot of these nodes, and therefor I have to optimize memory whenever possible. One such…
Markus B
  • 83
  • 1
  • 10
0
votes
1 answer

Doesn't STL functions in C++ work properly for long long int?

I have tried to use accumulate STL function for long long int data type. But it is showing garbage value in my compiler. But it works for int data type properly. #include #define ll long long using namespace std; int main() { …
Nakib
  • 19
  • 4
0
votes
2 answers

When I enter the value 200000 as an input for a long variable, C program crashes, why?

For the simple code below, whenever I enter the value 200,000 (or any other high value), the program crashes: long size; printf("Enter the size of the array to be sorted: "); scanf("%ld",&size); Can anybody tell me why? as based on my…
0
votes
3 answers

How does the C strtol interpret hex strings?

I expect strtol("ffffffffffffffff", NULL, 16) to return -1 and strtol("7fffffffffffffff", NULL, 16) to return LONG_MAX, since the linux man-page first sentence seems to imply strtol returns signed long. The second call does return the expected…
Moobius
  • 57
  • 1
  • 4
0
votes
2 answers

Converting a double to a long, then back to double?

Does Converting a double to a long, then back to double, guarantees keeping the exact value to the left of the decimal point? EDIT: Working with C++: Conversion is as follows: double d_var = func(); long l_var = (long)d_var; d_var = (double)l_var;
Physician
  • 483
  • 2
  • 7
0
votes
3 answers

Parsing string long to int with java and python

I am trying to convert some java code to python. I have a problem with the following java lines : int toto = (int)Long.parseLong("11101101111110100111001110011010",2); String result = Integer.reverseBytes(toto); In java, i get those results…
0
votes
1 answer

Why adding value to a long variable makes it lower?

I am trying to add 30 days to System.long a = System.currentTimeMillis() + ((long)30 * 24 * 60 * 60 * 1000); but it is deceasing the value? Why? This is what i have tried int days = 30; long a = System.currentTimeMillis(); long b = a + (days * 24 *…
farhad.kargaran
  • 2,233
  • 1
  • 24
  • 30
0
votes
3 answers

What happens when address of a long variable is store in char pointer?

I'm trying to understand what happens when I store a pointer of different data type into char pointer. I understand everything except why these two lines: … char *cc; long l; … cc = &l; printf("\nc: %ld, cc: %u", *cc, cc); are printing this: c:…
Nikhil G S
  • 25
  • 5