2,448 questions
0
votes
1
answer
31
views
AWS Amplify Long type to Int64 with Swift and GraphQL
I have issue where I cannot map Long type in Swift.
E.g. schema.graphql
scalar Long
input TableLongFilterInput {
between: [Long]
contains: Long
eq: Long
ge: Long
gt: Long
le: Long
lt: ...
0
votes
1
answer
131
views
Android: Filter CardViews in RecyclerView List with Room DAO
I have a RecylcerView List of CardViews. Each CardView holds user data that is saved in a Room database. Some of the CardViews have due dates that have been entered by the user with a TimePicker. I ...
4
votes
2
answers
267
views
How to avoid use of long in C++?
I work on a very large C++11 codebase, and we want to prevent future developers from declaring variables as long, since using long causes some issues when compiling on Windows compared to Linux.
Our ...
1
vote
1
answer
90
views
Memory allocation error when adding a long number to a dynamically updated array
I am trying to make a function which gathers the factors of long numbers. However I repeatedly get a
free()
error,
munmap_chunk()
error or
Assertion `(old_top == initial_top (av) && old_size ...
0
votes
0
answers
14
views
jQuery's native slider does not actually slide while using mobile phone [duplicate]
First off, here's my code:
$("#slider-range").slider({
range: true,
min: 0,
max: 500,
values: [75, 300],
slide: function(event, ui) {
$("#amount").val("$" + ui.values[0] +
" - $...
0
votes
1
answer
54
views
In .NET will a `decimal` equal to an `int` always cast to that `int`
In .NET, assuming that a decimal is not so large that it cannot be represented (or cause an overflow), will a decimal that is equal to an int always cast to the int that it is equal to ?
Same question ...
0
votes
1
answer
167
views
Why cant my long int handle the number 2971215073 in C?
So I have the following code:
#include <stdio.h>
unsigned long int fibonacci()
{
static int count = -1;
static int f1 = 0;
static int f2 = 1;
count++;
if(count == 0 || ...
1
vote
1
answer
128
views
Bug in the normalization step of Knuth Algorithm D (TAOCP 4.3.1)?
Knuth Algorithm D, during the normalization step (D1), states to set d to (b-1)//v_hi where b is the basis (word size or half-word size) and v_hi is the upper limb of the denominator. Then multiply ...
0
votes
0
answers
113
views
Elasticsearch rounds long number
I have an index in opensearch (elasticsearch) with a number field defined as long. Java LONG type has max value = 2^63, but when I try to write a number 2^53 + 1 to the index, it will write the ...
1
vote
0
answers
31
views
how to share hash() function output with multiprocessing.Array in python 3?
I need to share some 64-bit integers in a python 3 multiprocessing runtime.
I tried to use multiprocessing.Array, and it works on linux, but fails on Windows.
The long type for multiprocessing.Array ...
1
vote
2
answers
80
views
In a long table for a longitudinal study, how to loop efficiently across a large number of individuals?
I work on sexually transmitted diseases, such as gonorrhoea, and their possible consequences, such as ectopic pregnancy in women. I have a first dataset (df_gono) that contains whether and how many ...
-2
votes
1
answer
74
views
To print big integers using expressions why we need to declare initial variable as long too [duplicate]
so basically I had a code where I wanted to get the cube of the given integer
the input can be as big as 10^6 so when i used long long int and size_t and they did not work
until I changed the data ...
0
votes
1
answer
53
views
Why aren't large numbers working for this Ackerman Subarray Solution?
You are given two inputs for this program; <the_number> <checking_number>
For every sub-"array" you have, you need to sum up the digits of that sub-"array" and check if ...
0
votes
1
answer
130
views
How to convert Long datatype to Hex format in XSLT and Perform Long Parsing in XSLT. XSLT to be used in DataPower
Below is my .Net VB code.
How do we implement below code in XSLT (XSLT to be used in DataPower). Since we do not have Long datatype in XSLT, we're having tough time to implement below .Net code in ...
0
votes
1
answer
146
views
How to split large integers without converting to a string? [duplicate]
I ran into a problem when trying to convert a 5,000 digit long integer into a string.
I realised that I did not need an integer in that case, but I would still like to know if there is a way to ...
-1
votes
0
answers
37
views
Representing an 8-digit hexadecimal as a long [duplicate]
I am writing a Java program that performs bitwise operations on bites in a data stream.
I have been given test values in the form of 8-digit hexadecimal strings, which I have converted to base 10 and ...
1
vote
0
answers
95
views
Stable calculation of large binomial coefficients in c++ [duplicate]
I am looking for a way to reliably calculate large binomial coefficients in c++. My current implementation can handle numbers up to around n=60, but after that f * (n - i) exceeds the limit of long ...
0
votes
1
answer
40
views
How to change long format into wide and add new derived variable based on the original rows
I have a long table format and try to construct a wide format that contains additional variables based on the rows.
My data has rows based on patients, their treatments, and their visits. Each row ...
1
vote
1
answer
92
views
Different result in JS & PHP because of different integer range
<script>
function hs(e, n) {
return e * n % e;
}
alert(hs(1752865668, 1716717484170));
//result: 1752622684
</script>
<?php
function hs($e, $n) {
return $e * $n % $e;
}
echo ...
-1
votes
1
answer
182
views
Why does the sum give a different result when i add values and change the num variable from int to long data type [closed]
I've been trying the cs50 credit problem and i am stuck in the part where you add every other digit in the number. This is what i came up with.
#include <iostream>
using namespace std;
int main(...
0
votes
1
answer
127
views
C long int always accesses memory as big endian?
In the comment discussion of an old unanswered question, a fellow user is claiming that the C long int type "accesses memory in big endian mode".
I apologize beforehand for my lack of ...
1
vote
1
answer
164
views
C++ multiplication of long integers resulting in unexpected output [duplicate]
I have a simple C++ program that multiplies two long int variables and prints the result. Here's the code:
#include <iostream>
using namespace std;
int main() {
long int a = 100000;
...
4
votes
1
answer
319
views
Need large integers and floats. Trouble with long long int and long double
I am a sort of newbie to programming (actually coming back to it after a gap of 20 yrs :) ). I am trying to make a program for a question on project euler, to find sum of all prime numbers under 2 ...
2
votes
2
answers
245
views
SQLBindCol for long integer value on 64Bit platform?
I want to query data from an oracle db with unixodbc which has an NUMBER(19) column. So this must fit in an long under 64 bit. But i dont know the right type for the TargetType parameter.
With type ...
1
vote
1
answer
39
views
will there be overflow or not in this case
I want to know that why there is no error in this code when I run it, especially in this line ret[(int) b[i]] = p;. Actually this solution I found in leetcode contest 387, user who got rank 3.
public ...
0
votes
1
answer
133
views
How do I make a sorted, long compression data structure?
How can I create a set data structure which compresses a sorted array of longs?
Goal:
Must support the following operations:
insertion of new numbers
deletion of a certain value
intersection with ...
0
votes
0
answers
100
views
Facing issue while converting 18 digit double value to long
I am receiving double value [18-19 digits] as input to my method and I have to convert it to long value.
I have no interest in handling the decimal part of input as input will always be ending with .0
...
2
votes
2
answers
257
views
best way to recognize and handle integer overflow in c?
I am so new in C and so far I didn't comprehend how to prevent from integer overflow, I read many articles but still I am not 100% sure!
in this case
int ft_sqrt(int nb)
{
long int sqrt;
...
0
votes
1
answer
240
views
How to compress a strictly increasing sequence of Longs
What is the best way to compress a (sorted) monotically increasing sequence of longs?
Characteristics about the sequence:
all the values are unique (no repeated)
length of sequence can range from ...
1
vote
0
answers
281
views
Why this error happens: SUMMARY: AddressSanitizer: heap-buffer-overflow
I have my own long arithmetic set of functions. And I don't know why this error happens because I have only one function which is change the value of __INTINF var and when I increase the value I call ...
1
vote
1
answer
155
views
Challenge of Translating Python Code to C: Implementing Luhn Algorithm for Checksum Calculation
I'm currently working on implementing the Luhn algorithm in C for checksum calculation. However, I encountered an issue with my C code where it consistently produces incorrect output (giving 11 ...
0
votes
0
answers
67
views
Using pivot_longer in R in Kaggle, producing NAs for second half of data
Here is the data frame that I started with.
I tried to change it from wide to long using this code:
#change data frame from wide to long
us_population_v3 <- pivot_longer(us_population_v2, cols = !...
2
votes
2
answers
129
views
Why does this code overflows even when casting?
I am studying for an exam that involves C. but I am encountering an error on the variables even when casting them. The code is copied from the powerpoint the professor gave us.
I was going through the ...
0
votes
3
answers
75
views
How do I fix my unit converter in python? [duplicate]
Every time I try to convert it, it only shows the conversion from in. to mm.(aka the 1st expression)I would really appreciate it if you can help because I spent a long time.
a = input('Original Amount:...
1
vote
3
answers
144
views
Compare int with leading zero int
#include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (a == b)
printf("equal");
}
so I input the number with 001 and 1, but ...
-3
votes
2
answers
177
views
Word width before and after multiplication
I can't tell if anyone had asked this question before. The root behind this question is the mistake (in my opinion) in standard C or C++ in that the implicit word width of an integer product after ...
1
vote
2
answers
114
views
Unable to get percentage with 'int' even though value is within range. Works with 'long' though. Why?
Can anyone explain to me why is util2=49, but util1=5?
Program:
#include <stdio.h>
int main()
{
int load1 = 47759534;
int capacity1 = 96000000;
long load2 = 47759534;
int capacity2 = 96000000;
...
1
vote
1
answer
83
views
Long not giving the result I expect it to
I am using the below code to get a long int sum of 2 numbers.
I take the inputs as long ints and expecting a long int answer through printf but am getting the result as a negative number.
#include <...
-2
votes
2
answers
189
views
Problem in digitizing a number and putting it in an array reversed
I am writing a C++ function which takes a positive number and returns an array containing its digits reversed.
#include <cmath>
#include <vector>
std::vector<int> digitize(unsigned ...
0
votes
3
answers
164
views
Primitive Integert Datatype Limits in Java
I have a Java programt o display the limits of primitive integer datatypes which is as follows:
import static java.lang.Math.*;
class HelloWorld {
public static void main(String[] args) {
...
1
vote
2
answers
287
views
Why does Random.NextInt64 create duplicates and not distribute the values across the whole range
I have written a small C# console application to generate a million random longs
I have already included ThreadLocal to avoid creating duplicates
here if the code I am running:
var random = new ...
0
votes
0
answers
45
views
long arithmetic in C [duplicate]
can you divide two long datatypes and turn them into a fraction? If not, would you have to type convert the datatypes into floats? Can someone explain how long arithmetic works in C.
This is a snippet ...
1
vote
1
answer
656
views
C: LONG_MIN and LONG_MAX are wrong [duplicate]
Running Windows 64 bit system. Values appear as if they are just int.
int main()
{
long long_min = LONG_MIN;
long long_max = LONG_MAX;
printf("Minimum value of long: %ld \n", ...
0
votes
1
answer
52
views
Properties with Long type and properties with Integer type
<div class="mb-3 col-md-6">
<label asp-for="@Model.MERSISNumber" class="form-label">MERSIS Numarası</label>
<input class="form-control&...
8
votes
5
answers
3k
views
Why does an operation on a large integer silently overflow?
I have a list that contains very large integers and I want to cast it into a pandas column with a specific dtype. As an example, if the list contains 2**31, which is outside the limit of int32 dtype, ...
0
votes
0
answers
42
views
Type casting and sorting two arrays in java [duplicate]
I'm trying to sort an array in java using the inbuilt comparator and sort method but it is giving me an error incompatible type, object cannot be converted to int
I want to sort an array and also want ...
-4
votes
2
answers
140
views
long integer is out of range negative product
I was trying to find product of some long long integer (0<=a[i]<=10^18)t. now how do i find that the product exeeds 10^18? does the product turn into negetive number (product<0)?
#include<...
-1
votes
2
answers
109
views
Why won't my C long store a number bigger than a regular Int?
For some reason I cannot get the number 4294967296, or any bigger to be stored in a long.
On the second run through the loop the change variable goes to 0 after being multiplied despite being a long.
...
1
vote
0
answers
218
views
How to insert small int values to NumberLong in document DB / mongo DB by using python/pymongo
When we are trying to insert small integer values let's say 45 to documentDB.
It's been saved as just an integer/Number value in documentDB.
But I want that to be saved as NumberLong irrespective of ...
1
vote
0
answers
275
views
Converting a long to bytes for efficient transmission [duplicate]
I'm creating a serialisation format, and part of the header is the length of the body.
To do this, I'm allocating a fixed number of bytes (currently 4) which I want to use to store as long a number as ...