largenumber Questions

11

What is the best way to handle large numeric inputs in C++ (for example 10^100)? For algorithms I usually switch over to ruby and I sometimes use strings. Any other good methods?
Vorous asked 22/9, 2008 at 20:31

4

Solved

I'd like to calculate the square root of a number bigger than 10^2000 in Python. If I treat this number like a normal integer, I will always get this result back: Traceback (most recent call last)...
Danie asked 17/12, 2017 at 11:29

2

Solved

I've done this to format the number, but it fails for large numbers let formatter = NumberFormatter() formatter.numberStyle = .decimal if let number = formatter.number(from: "123456789123456789...
Cooksey asked 22/3, 2020 at 10:7

11

Solved

I'm trying to work through the problems on projecteuler.net but I keep running into a couple of problems. The first is a question of storing large quanities of elements in a List<t>. I keep ...
Thermit asked 10/11, 2008 at 20:22

6

Solved

I've been considering fast poker hand evaluation in Python. It occurred to me that one way to speed the process up would be to represent all the card faces and suits as prime numbers and multiply t...
Historiographer asked 11/2, 2009 at 20:13

14

Solved

I'd like to implement a big int class in C++ as a programming exercise—a class that can handle numbers bigger than a long int. I know that there are several open source implementations out th...
Wirework asked 6/11, 2008 at 16:11

4

Solved

in_range = int(input("range: ")) fibo_list = [] a = 0 b = 1 count = 0 if in_range < 0: print("faulty") elif in_range == 0: print("faulty") else: while count < in_range: c = a + b a = ...
Brotherson asked 3/12, 2019 at 2:4

12

Solved

I tried to find the factorial of a large number e.g. 8785856 in a typical way using for-loop and double data type. But it is displaying infinity as the result, may be because it is exceeding its l...
Predikant asked 12/7, 2012 at 7:29

2

Solved

2022 Update: This bug was filed as a GHC ticket and is now fixed: https://gitlab.haskell.org/ghc/ghc/issues/17231 so this is no longer an issue. Using ghci 8.6.5 I want to calculate the square root...
Vaporimeter asked 20/9, 2019 at 21:13

13

Solved

Currently I am borrowing java.math.BigInteger from the J# libraries as described here. Having never used a library for working with large integers before, this seems slow, on the order of 10 times ...
Dynamo asked 7/10, 2008 at 0:16

3

Solved

Is there any library function for this purpose, so I don't do it by hand and risk ending in TDWTF? echo ceil(31497230840470473074370324734723042.6); // Expected result 314972308404704730743703247...
Afterburning asked 23/10, 2008 at 19:15

3

Solved

How can we generate very large random number in java? I am talking something like 10000 digits? I know we have to use BigInteger but how can we do this? What is the most efficent way of doing somet...
Mcgarry asked 23/11, 2011 at 15:25

3

I'm trying to implement a BigInteger class in C++. How can the base data be represented? The most naive way is to have a fixed or dynamic array of char and store each digit of an integer in a...
Patagonia asked 22/12, 2010 at 7:42

2

Solved

In my understanding, sys.float_info.max is the largest possible float value. However, it seems that comparing such large values fail. import math import sys m = sys.float_info.max # type 'float' ...
Brutify asked 28/10, 2018 at 9:49

3

What's the most efficient way to implement Karatsuba large number multiplication with input operands of unequal size and whose size is not a power of 2 and perhaps not even an even number? Padding ...
Nudicaul asked 12/5, 2013 at 0:23

6

Is there an equivalent to Java's BigInteger class in Swift? I am tying to do large calculations in Swift with positive integers larger than UInt64 maximum valye. What is the best way to handle thes...
Halfwitted asked 27/8, 2014 at 16:2

6

Solved

How can I check whether a number is a power of 2? Below is what I have come up with so far: # check every number in a vector y <- 1:100000000 x <- 2^(0:100) y %in% x y[(y %in% x)==TRUE] # c...
Quintile asked 4/3, 2014 at 10:37

3

Solved

I am trying to calculate 1 + 1 * 2 + 1 * 2 * 3 + 1 * 2 * 3 * 4 + ... + 1 * 2 * ... * n where n is the user input. It works for values of n up to 12. I want to calculate the sum for n = 13, n = 14 a...
Widdershins asked 30/5, 2017 at 10:23

7

Solved

I haven't really used variance calculation that much, and I don't know quite what to expect. Actually I'm not too good with math at all. I have a an array of 1000000 random numeric values in the r...
Capacity asked 12/11, 2009 at 12:51

3

Solved

I was using this function for a long time and was happy with it. You probably saw it millions of times. It is even in the example section of the MDN documentation for Math.random()! function rando...
Orator asked 23/3, 2014 at 10:37

2

I am Currently trying to write some code in VBA to solve a problem from Project Euler. I have been trying to answer a question that requires you to find primes that can be divided into a number tha...
Glassco asked 3/12, 2009 at 15:31

2

Solved

public static string GetProperty(SearchResult searchResult, string PropertyName) { if (searchResult.Properties.Contains(PropertyName)) { return searchResult.Properties[PropertyName][0].ToStrin...
Tortoiseshell asked 4/9, 2013 at 13:10

2

Solved

I have a dataset on which I'm trying to apply some arithmetical method. The thing is it gives me relatively large numbers, and when I do it with numpy, they're stocked as 0. The weird thing ...
Brosine asked 17/5, 2016 at 9:3

2

Solved

15955067621307336078.toString(36); returns '3d7vzfy5k2as8' in Javascript because the large integer cannot be represented (the correct answer is '3d7vzfy5k29ou'). Does someone have a clever functi...
Sewerage asked 26/11, 2012 at 21:38

1

Solved

Assuming that the computer running this program has an infinite amount of memory, I'm interested in where Python will break when running the following: For fun, I implemented hyperoperators in pyt...
Janinajanine asked 21/2, 2016 at 22:7

© 2022 - 2024 — McMap. All rights reserved.