Hi, is there a data type larger than unsigned long long int except double? I don't want double or float because I need to keep it as precise as possible. I also need it to be able to do modulus. How would I do this?

Recommended Answers

All 12 Replies

Hi, is there a data type larger than unsigned long long int except double? I don't want double or float because I need to keep it as precise as possible. I also need it to be able to do modulus. How would I do this?

GMP is uniquely great. Yet, how large is very large integer?

tesuji how large you want your number to be???
However large it is it is always generated by computer try multiplying two largest numbers known to u and I think you will end up with getting a longer number!!!!!!
(you can use FFT algorithm to multiply extremely large numbers)

It needs to be able to hold about one quintillion.

quintillion? thats not a large number.

now about seven years ago, i worked on a cryptographic accelerator with a 4,096-bit number... that was large


,

Oh, not that large, only 10 power 30 !
Possibly you need something badly better than fft :icon_mrgreen: (n*ld(n))

so tesuji can you suggest an algorithm better than FFT for getting large numbers(of the order of 10 power 30 or more)?????????

Iamtwhee answered this question here: Click

(have fun :) )

so tesuji can you suggest an algorithm better than FFT for getting large numbers(of the order of 10 power 30 or more)?????????

If I were God first I would create new universe to be able to store quintillion figures of those numbers because Milky Way obviously too small. Then I would install just one quintillion hyper light-speed computers everywhere in that new universe to do multiplication recursively by massive parallel computing. Maybe that will help.

> an algorithm better than FFT for getting large numbers(of the order of 10 power 30 or more)?
FFT multiplications are efficient when numbers are very large. the other popular multiplication algorithms are Karatsuba and Toom-3. http://gmplib.org/manual/Multiplication-Algorithms.html#Multiplication-Algorithms

in general Karatsuba is suitable for smaller numbers, Toom-3 for larger numbers and FFT for very large numbers. which is the most appropriate for a particular number depends on the processor.
for example, for a x86/pentium4/sse2 processor, GMP has determined the following thresholds for multiplication (in number of limbs: 32-bits per limb on this processor)
Karatsuba 18 limbs
Toom-3 139 limbs
FFT MODF 456 limbs
FFT 5888 limbs
from gmp-4.1.4/mpn/x86/pentium4/sse2/gmp-mparam.h
http://www.srcdoc.com/gmp_4.1.4/

hey vijayan gr8 link thanx

I'm using the GMP library which works great.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.