Working with BIG big numbers
From: Robert Diamond (deadram_at_i.dont.like.spam.rogers.so.dont.sent.it.com)
Date: 11/02/03
- Next message: Christophe Vanfleteren: "Re: Working with BIG big numbers"
- Previous message: Mark Haase: "Re: Why?"
- Next in thread: Christophe Vanfleteren: "Re: Working with BIG big numbers"
- Reply: Christophe Vanfleteren: "Re: Working with BIG big numbers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 02 Nov 2003 09:51:56 GMT
Hi everyone, and thanks in advance,
Just trying to find a way to get a number that's bigger then java's
double. I've tried stuff like "long double myBigNumber;" but that doesn't
seem to work. Been checking google too, and still haven't found any info. I
was working on a Fibonacci number calculator and got it to calculate up to
the 1476th number as a double but the accuracy of the last few remaining
digits are a little off, and over 70% of it is 0's. Here's the output:
Please input an integer (0 <= N <= 1476): 1476
Fibonacci results:
(NOTE: As accurate as a double, last few digits may be incorrect...)
recursive(int n)
N: 1476
Solution:
1306989223763398700000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000
0000000000000000000000000000000000000000000000000000000000000000000000000000
000
Time: 0.0
iterative(int n)
N: 1476
Solution:
1306989223763398300000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000
0000000000000000000000000000000000000000000000000000000000000000000000000000
000
Time: 0.0
Press any key to continue...
The real 1476th number is:
1306989223763399318036311553802719830983924439074
1264072600665946019279307047923174028868108777701
7721095463154979012276234322246936939647185366706
3684893626608441474499413484628009227558189696347
4334898291642495406274413596986561540727649241065
3721774590669544801490837649161732095972658064630
033793347171632
So I'm looking for some way to have a variable that will save that much
data. The obvious workaround of making my own number object is tempting, and
I'll probably be working on that for shits and giggles, but I'd much prefer
using some sort of standard way to store BIG big numbers. Thanks again.
-- Robert Diamond <-rob-@rogers.com> I sleep 6 days a week. You should try it, you live an extra 52 days a year!
- Next message: Christophe Vanfleteren: "Re: Working with BIG big numbers"
- Previous message: Mark Haase: "Re: Why?"
- Next in thread: Christophe Vanfleteren: "Re: Working with BIG big numbers"
- Reply: Christophe Vanfleteren: "Re: Working with BIG big numbers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]