Questions tagged [bignum]

Common computer-jargon term to refer to arbitrary-precision math and data-types. The term "arbitrary-precision" refers to the ability of a machine to perform numerical computations whose precision is limited only by the available memory.

362 questions
0
votes
1 answer

Algorithm for converting an arbitrarily long String representing a decimal number into a String representing a hexadecimal number

I am currently working on a program in C17, which receives a string from the command line, lets call it st_in. I know that st_in will only contain chars in range [0x30, 0x39], thus represent a decimal number of arbitrary size. I want to convert this…
0
votes
2 answers

javascript problem with big numbers and bitwise operation

In my program I generate the code from the incoming number "int". Sometimes I need to do the reverse action, translate the code into a number. With small numbers, it works fine. const int = 10203040 const code1 = (int >> 16) & 0xFFFF const code2 =…
0
votes
1 answer

Converting a BigNum (binary w/ repeating digits) to decimal

I currently have a big-num implementation based on rational numbers (with repeating digits) that stores the following (in binary): Integer part Fraction part Repeating fraction part Some examples (Expressed as .()): 2.5…
Filipe Rodrigues
  • 1,843
  • 2
  • 12
  • 21
0
votes
0 answers

How to implement addition and multiplication for 256-bit unsigned integer using Intel's ADX intructions?

I need to do arithmetic operations on 256-bit unsigned integer and I need a fast implementation. AFAIK, SIMD instructions do not help because of carry propagation (Can long integer routines benefit from SSE?) and Intel's ADX instructions can…
phqb
  • 351
  • 3
  • 14
0
votes
1 answer

compute the remainder of the BIGNUM divided by any integer modulo

given some string, let assume , hello world. I know that the string in bits is: 01101000 01100101 01101100 01101100 01101111 00100000 01110111 01101111 01110010 01101100 01100100. so the value of the bits is 126207244316550804821666916. I was able…
hah
  • 119
  • 4
0
votes
1 answer

What's the fastest implementation for bignum? (Java's bigInteger / Cython's int / gmpy / etc...)

Are there any benchmark on this??? (I tried googling for some results but found none... and I couldn't test gmpy because gmplib wouldn't be installed on my laptop) thank you!
user269334
  • 539
  • 1
  • 6
  • 13
0
votes
0 answers

Is there a requirement to use context in OpenSSL MP functions?

Part of the functions from take BN_CTX *ctx as the last argument. This is a structure that stores temporary BIGNUM variables, allowing you to avoid frequent memory allocation when creating variables with repeated subroutine calls. I…
0
votes
1 answer

Ethers BigNumber to USD conversion

I'm trying to convert an Ethereum value to its retrospective fiat value. The final value of USD seems wrong, and I wonder if it's how it's calculated with big numbers. I've attached a sandbox for…
Xavier
  • 93
  • 1
  • 4
0
votes
0 answers

How to avoid rounding number incorrectly when using Number or BigNumber library from JavaScript for web3.js?

I have the following function to get the token balance from a web3 contract with web3.js The contract has 18 decimal point and interacting via Metamask: async function getTokensBalance() { const w3 = await new Web3(window.ethereum); …
Pro Girl
  • 762
  • 7
  • 21
0
votes
0 answers

How was boost cpp_int arithmetic operations were implemented?

I have look at GMPs source code and It seems to me that it uses hand written assembly code to achieve fast peformance in its mpz_*/mpn_* arithmetic implementations, but when I look at boost's source code, I don't see any hand written assembly code…
Bondrewd
  • 1
  • 2
0
votes
2 answers

Parse Float string to number rounding off javascript

I have the string "9999999999999.99999" which I covert using Parse Float. But it changes the value to 10000000000000 , is there anyway I can have the get the number same without rounding off? The input is string and out must be number not…
0
votes
1 answer

How to implement Big Int in Javascript?

I am working on open-source project. It doesn’t properly meet its specs due to the representation as JavaScript numbers ie let,const... I want to add support for Int, Long Int, and Big Ints similar to c++. Can anyone please suggest any resource or…
James_sheford
  • 153
  • 2
  • 13
0
votes
1 answer

Creating BigQuery table column with BIGNUMERIC data type using Java

When creating BigQuery tables using the Java com.google.cloud:google-cloud-bigquery library, I don't see the BIGNUMERIC column data-type in the StandardSQLTypeName enumerations. I see NUMERIC but not BIGNUMERIC. How would I create a table with a…
0
votes
0 answers

Is there any way in Python 3 to get floats bigger than numpy.float128?

I was trying to make some code that involved giant numbers so I used numpy.float128. Though it did help a little, it didn't really help me because the numbers I was using were even too big for that. So is there anything I can do to get numbers with…
0
votes
0 answers

dealing with very big numbers in php

when working with very big numbers, php convert it to scientific notation, and I exactly need the number not the scientific notation, what should I do? also strval doesn't work . $x=15698545987213548634564235131; when echo, the output is…