Questions tagged [integer]
Use this tag for questions about using, storing or manipulating integral values of all types and sizes, including concerns about overflow. Not for code that casually happens to use integers.
394 questions
5
votes
2
answers
825
views
Bruteforce integer multiplication in Java
Intro
This time, I have attempted to prove the following bruteforce multiplication formula:
$$
(a_n \cdots a_0) \cdot (b_m \cdots b_0) = \sum_{i = 0}^n \sum_{j = 0}^m a_i b_j \cdot 10^{i + j},
$$
...
14
votes
5
answers
3k
views
Infinite precision integer in C++20
This is my infinite precision integer implemented in C++20. It supports negative numbers. I have implemented addition, subtraction, multiplication and binary integer division, which returns quotient ...
-5
votes
1
answer
354
views
int128 handling in C code, gcc / glibc / linux - follow up IV [closed]
[edit] Hint: a similar project for C++20 which - as far as I see - also manages bigger than 128-bit integers can be found at: Infinite precision integer in C++20 . [/edit]
I got lots of kind hints on ...
3
votes
3
answers
564
views
int128 handling in c-code, gcc / glibc / linux - follow up III
I got helpful reviews for first steps in:
int128 handling in c-code, gcc / glibc / linux,
int128 handling in c-code, gcc / glibc / linux - follow up and
int128 handling in c-code, gcc / glibc / linux -...
3
votes
1
answer
199
views
Int128 for handling large numbers bassed off of BigInteger update
An update to Int128 That is built on Linux for lack of direct support, based on System.Numerics Nuget package.
...
3
votes
2
answers
836
views
int128 handling in c-code, gcc / glibc / linux - follow up II
I got very nice reviews for an attempt to produce read and print
routines for 128-bit integer datatypes in:
int128 handling in c-code, gcc / glibc / linux and:
int128 handling in c-code, gcc / glibc / ...
4
votes
1
answer
203
views
Int128 for handling large numbers based off of BigInteger
I have created Int128 which is based off of BigInteger with operator overloading to handle larger math requirements. Here is a ...
5
votes
2
answers
380
views
int128 handling in c-code, gcc / glibc / linux - follow up
I had a draft for int128 handling reviewed there:
int128 handling in c-code, gcc / glibc / linux
I changed a lot according to the hints there, while leaving in, e.g.,
a trailing space on each line, ...
3
votes
0
answers
112
views
Comparing two Tree sort algorithm variations implemented in Java
I have this repository. It contains three variations of a simple sorting algorithm for integer keys.
The idea is that we keep a balanced BST in which each node holds the integer key and its frequency. ...
2
votes
1
answer
238
views
Pollard's rho algorithm implementation
I used std::multiset to determine how many times that factor appears.
I'd like to know if it can be improved; I've focused on the algorithm rather than the code.
...
2
votes
1
answer
144
views
What is the most efficient way to figure out if a single number is prime for numbers from 2 up to 2,147,483,647 in Java?
As Java programmers, we can always use the BigInteger isProbablePrime() method or store manually all prime numbers in a HashMap. This question is about the most efficient way to figure out if a single ...
6
votes
2
answers
298
views
Bit manipulation to find a monochromatic clique on k vertices knowing all on k-1 vertices
I have a very hot segment of code in a large project. I've extracted the relevant segment and a toy example to illustrate it.
The project involves an unavoidable combinatorial explosion related to ...
3
votes
2
answers
306
views
im2double and im2uint8 Functions Implementation for Image in C++
This is a follow-up question for conv2 Template Function Implementation for Image in C++ and An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++. For performing ...
5
votes
0
answers
108
views
Dial's heap in Java for integer priority queues
(The entire project is here.)
Intro
I have this priority queue data structure for non-negative integer priority keys. I recall that it is called Dial's heap.
Code
Implementation
...
9
votes
3
answers
1k
views
C function to read only numeric values
I'm learning C and as exercise I'm trying to implement a custom function to parse a input from user and return successfully only if the input is a number.
These are my files, how could I improve it?
...