332 questions
2
votes
0
answers
120
views
Implementing Arbitrary Precision Arithmetic in CubeCL for Infinite Zoom Fractals
Context
I'm implementing a Julia set fractal renderer using CubeCL (a Rust GPU compute framework). I want to achieve "infinite zoom" similar to deep Mandelbrot zoom videos, which requires ...
1
vote
1
answer
62
views
Does the binary representation of a fixnum include a sign bit?
TL;DR:
In Emacs Lisp, is the sign of a fixnum part of its binary representation or stored in some metadata? What's the distinction between positive and negative fixnums?
Can the sign be switched in ...
0
votes
0
answers
42
views
Eigen 3.4 cannot find mpreal.h?
I am writing a program called moments++ (https://github.com/gvbarroso/momentspp). This program uses Eigen 3.4. Some scenarios lead to precision issues in the matrices (using long double). Thus, I want ...
0
votes
0
answers
32
views
How to constructing rational values with Flint ARB
I have the following code where I try to use fmpz_t to prime factor rationales of a system constant.
/* gcc -I/usr/local/include/flint -o arb arb.c -lflint */
# include "arb.h"
...
0
votes
2
answers
200
views
Why 5.0 / 2 returns 2.5000000000000000 (scale of 16) instead of 2.5 (scale of 1)?
Fiddle
select 5.0 / 2
, pg_typeof(5.0 / 2);
pg_typeof
2.5000000000000000
numeric
Why the result is 2.5000000000000000?
When we insert 2.5 into a numeric column or select 2.5 from a numeric column ...
1
vote
1
answer
64
views
Boost multiprecision library
Boost multiprecision libraries highest value possible
Can the boost multiprecision handle values as large as googolplex , like maybe the boost multiprecision cpp dec float library?
So can someone ...
0
votes
0
answers
47
views
Confused with matlab arbitrary precision toolboxes
I have a recursive computation code of mine (containing only simple +, *, exp, etc arithmetic on complex valuated numbers) that starts to loose precision when increasing the depth of iterations and I ...
0
votes
1
answer
44
views
Represent tiny numbers in Matlab using sym and vpa
I need to store some really tiny positive and negative numbers in Matlab. One way is to store their signs separately, and the log10 of their magnitude, which lets me store numbers as small as 10^(-...
2
votes
3
answers
164
views
A faster way of comparing arrays of integers lexicographically
I'm currently writing an arbitrary precision library for fun (yes, I know that GMP exists) and I'm using it to generate large prime numbers (~5000 digits) with the Miller-Rabin primality test. I ...
0
votes
1
answer
68
views
mpmath and mathmatica discrepancy in output
edited because my main issue lies with incorrect results from mp.math.
I need to eventually do very precise calculations with complex numbers, which is why I am trying to use the mp module from mp....
3
votes
1
answer
409
views
Can AVX-512 be used to calculate the multiplication of two 256-bit Integers on a 64 bit computer in C++? Whether using Assembly Language or not
Regarding arbitrary precision arithmetic: Can AVX-512 be used to calculate the multiplication of two 256-bit Integers on a 64-bit computer in C++?
Is there an intrinsic Integer data type of 512 bits ...
-1
votes
2
answers
240
views
Calculating the fixed-point representation of (1 - SQRT(0.5)) to arbitrary levels of precision
I have a constant 0.29289321881345247559915563789515..., which can be calculated using the equation (1 - SQRT(0.5)) and then transformed into fixed-point format in order to be used with various sizes ...
0
votes
0
answers
77
views
why Java BigDecimal giving Precision Errors
i am using java big decimal. but still i am not getting expected result..
public class DecimalAdjustEx {
public static void main(String[] args) {
BigDecimal v1 = new BigDecimal("100&...
1
vote
1
answer
294
views
How to force Julia to use multiple threads for matrix multiplication?
I want to find powers of a relatively small matrix, but this matrix consists of rational numbers of type Rational{BigInt}. By default, Julia utilizes only a single thread for such computations. I want ...
2
votes
1
answer
88
views
Use VPA to evaluate tiny probabilities
For a statistics application, I need to evaluate tiny chi-square probabilities. But when this becomes smaller than matlab's double-precision limit realmin (around 1e-308), it returns 0.
x=50;
p=...
0
votes
4
answers
352
views
How to feature test for BigInt support?
I'm not familiar with modern JS and tooling to even try something.
References:
https://github.com/tc39/proposal-bigint
-1
votes
1
answer
123
views
Is it possible to implement IEEE 754 conforming floating-point arithmetic based on ARM pseudocode using finite precision floating-point arithmetic?
Background: usually floating-point arithmetic is implemented using integer arithmetic (for example, Berkeley SoftFloat). Per ARM pseudocode [1] floating-point arithmetic is implemented using infinite ...
1
vote
1
answer
210
views
Python Sympy and mpmath give different results
I did an evaluation of mpmath and sympy and found inconsistencies, which I cannot resolve. I believe mpmath gives correct results. Please, can somebody help in resolving this?
import sympy as sp
...
2
votes
1
answer
201
views
What causes this loss of precision for increasing number of roots found?
I have a while loop that calculates the roots of my equation. It works perfectly when I am working with low numbers, for example 100, the precision is a little more than 250 decimal places (I need 250 ...
2
votes
0
answers
94
views
Getting extended precision values of incomplete gamma functions using mpfr::mpreal
I am trying to obtain the value of an incomplete gamma function with complex arguments, to be precise I am interested in obtaining Gamma[0, a + i*b] for real parameters a,b.
I'm using mpfr in C++ for ...
1
vote
2
answers
2k
views
Copy a u128 into [u64;2]
How can a u128 be converted to an array of u64s. While passing a u128 to an API which takes arbitrary precision int, the API takes 3 parameters
LLVMValueRef LLVMConstIntOfArbitraryPrecision (
...
0
votes
2
answers
285
views
Exceeding the range of long double and big floating point numbers
Problem statement: I am working on a code that calculates big numbers. Hence, I am easily get beyond the maximum length of "long double". Here is an example below, where part of the code is ...
0
votes
1
answer
2k
views
How does postgresql cast float to numeric?
I was wondering how Postgresql converts floating point (float4) values to NUMERIC.
I chose 0.1 as a testing value. This value is not accurately representable in base2, see https://float.exposed/...
-2
votes
2
answers
469
views
How to convert large HEX string to INT in C
I got large HEX string in result into int i could be more than 10 ^ 30, and I converted in hex. I need sum (3 hex string) and remove last 12 numbers.
hex example "...
-1
votes
1
answer
1k
views
How to make dynamic bit width integers in C?
I want to represent extended integers and came across _BitInt() but it doesn't work dynamically.
I'm trying to do something like this:
void fun(int n)
{
_BitInt(n)* val = malloc(n); //doesn't work
...
0
votes
1
answer
150
views
PHP arbitrary precision with dec/hex conversion
I need to do arbitrary precision math in PHP.
But the bcmath implementation doesn't seem to have ways to convert between decimal and binary/hex.
I need to take an arbitrary precision number WITH RADIX ...
0
votes
0
answers
165
views
Algorithm for a Pow2() function for fractions?
Does anyone know an algorithm for a Pow2() function for fractions?
For a function of the following form, where BigRational stands for any rational number type, with arbitrarily large integers for ...
0
votes
0
answers
187
views
Arbitrary multiprecision inside the integrand of a GSL monte carlo integration
My aim is to use GSL monte carlo integration for an integrand in which an arbitrary multiprecision library (Boost) is used. I decided to use an arbitrary multiprecision library because the integral ...
0
votes
1
answer
473
views
gpu.js with BigDecimal or float64array possible?
I am writing a mandelbrot-calculator with the help of gpu.js and till now, everything works perfectly fine. The only issue I am facing is, that the GPU only wants to compute 32-Bit floats. Or at least ...
3
votes
1
answer
1k
views
Go/Golang: how to extract least significant digits from big.Float?
In Go/Golang I have a variable of type big.Float with an (arbitrary) precision of 3,324,000 to represent a decimal number of 1,000,000 digits. It's the result of an iteration to calculate pi.
Now I ...
10
votes
2
answers
4k
views
Arbitrary precision integer on GPU
I'm currently doing a primality test on huge numbers (up to 10M digits).
Right now, I'm using a c program using the GMP library. I did some parallelization using OpenMP and got a nice speedup (3.5~ ...
4
votes
1
answer
91
views
Using structs in parametric types, not only primitive types
The problem arose while I was working with Mods.jl. This package does not support arbitrary-precision arithmetic because only primitive types can be passed as parameters, i.e. Mod{17} works fine, but ...
0
votes
1
answer
511
views
Rounding errors: deal with operation on vectors with very small components
Imagine to have some vectors (could be a torch tensor or a numpy array) with a huge number of components, each one very small (~ 1e-10).
Let's say that we want to calculate the norm of one of these ...
2
votes
1
answer
496
views
How does BigInteger algorithm work internally (Java)?
How does Java's BigInteger divide work internally? I did a ton of research and I can't find anything. So instead, I did some research into how CPUs do division, and looked into stuff like restoring/...
1
vote
1
answer
956
views
String of float to IEEE 754 binary128 in Python
I want a function like this:
>>> binary128_to_hex("1.0")
'3fff0000000000000000000000000000'
I currently use C and qemu-aarch64 to do this on my x86 laptop. How can I implement such ...
1
vote
0
answers
80
views
When have enough bits of my series with non-negative terms been calculated?
I have a power series with all terms non-negative which I want to evaluate to some arbitrarily set precision p (the length in binary digits of a MPFR floating-point mantissa). The result should be ...
1
vote
0
answers
241
views
How to optimize converting an unsigned arbitrary precision integer to a string for printing?
I am working on an unsigned arbitrary precision integer class in C++, just as an exercise for myself. While running some benchmarks (calculating the Fibonacci sequence at some number) I noticed that ...
2
votes
1
answer
221
views
How to print variables using FMZM high precision fortran
I would like to use FM package capabilities for the study of a problem in number theory.
I installed the package, compiled libraries, and ran the two test suites supplied, all without any problems.
I ...
2
votes
1
answer
230
views
Why are rational numbers from Num printed as <abstr>?
I continue with my exploration on the Num library of Ocaml, with the reason that one whole library about logics was written using it.
Today, I would like to make the negative of a rational number. ...
1
vote
1
answer
260
views
what's best way for awk to check arbitrary integer precision
from GNU gawk's page
https://www.gnu.org/software/gawk/manual/html_node/Checking-for-MPFR.html
they have a formula to check arbitrary precision
function adequate_math_precision(n) { return (1 != (1+(...
1
vote
0
answers
257
views
Mixed precision arithmetic: Algorithm for big float division with big integer mantissa?
I have written a Big Integer class that works well. I want to write a Big Decimal class. I've structure the class as a float with a base 10 exponent--i.e. in the form of M*10^e where 10^0 implies the ...
0
votes
1
answer
128
views
How to make BigDecimal division more precise
I'm having an issue with BigDecimals, the simplified idea is to:
define a value for the total
split the total in 3 parts defined by weights, these weights are 3 double values that add up to 100.0
sum ...
1
vote
1
answer
139
views
Is there a way to pass arbitrary precision numbers between fortran and python?
I am currently writing a program that is heavy on finite differencing. The problem is that to get the accuracy I'd need, I need to use arbitrary precision arithmetic. I have a purely Python script ...
1
vote
1
answer
166
views
How does libraries like MPFR store and manipulate real numbers of arbitrary precision? [closed]
I am currently working on an application that requires, the usage of arbitrary large precision real numbers to calculate pi to a very large precision range. I've found MPFR an amazing library highly ...
3
votes
1
answer
163
views
How to get higher precision for sine using the Arb library?
I found the Arb library, which should be able to compute very high precision values of sine, given enough time. However, I am unable to.
Trying the sine example, I could get the predicted output.
...
-1
votes
2
answers
2k
views
Double precision and quadruple precision in MATLAB
I want to convert data(double precision,15 decimal points) to data of another type(quadruple precision,34 decimal points). So, I used vpa function like this:
data = sin(2*pi*frequency*time);
quad_data ...
2
votes
1
answer
173
views
Trying to convert large integers to binary using as.binary
I have large integers that I need to convert to binary, but I keep getting this warning message:
Warning messages:
In h(num) : probable complete loss of accuracy in modulus 2:
In diff(x%%2^(...
1
vote
2
answers
2k
views
BigNumber.js calculation shows different value when done same calculation in C# using decimal datatype
I have been using BigNumber.js library for high precision arithmetic calculation. To maintain higher precision I am using toFixed method of the Bignumber object like this:
(new BigNumber(6000 )).minus(...
1
vote
1
answer
497
views
Convert binary arbitray-precision floating point to any base
Suppose I have a binary floating point notation (e.g. 1001.011101) with arbitrary precision 2^(-n) after the floating point, how can I convert it to any base, say ternary or decimal.
For the integer ...
3
votes
1
answer
251
views
Haskell/GHC - Is there a way around Haskell only returning 16 decimal places?
I am trying to write a program in Haskell that returns 'e' (Euler's number) to a given decimal place. Here is my code so far:
factorial 0 = 1
factorial n = n * factorial (n - 1)
calculateE a
| a ...