|
-
Sep 28th, 2006, 06:42 PM
#1
Thread Starter
Lively Member
Longs are too small!
So, here I am, working on number theory, thinking, "Ach, I hate doing aaaaalllllll this binomial expansion crud, I wish there was a program... "
Duh! Whipped it up in about an hour.
But than I try a daring exponent, something to the affect of 480505715157551513815415, long enough to throw an exception. Not enough space, o noes! What to do, what to do?
I wasn't sure if there was a way to declare a variable with a different memory allocation, larger than the big bad 64 I got.
Help is, as always, appreciated =)
AZURE
Act 1: Ruby
Act 2: Cavara Militari
Act 3:
Act 4:
Act 5: Cogito ergo sum
-
Sep 28th, 2006, 07:26 PM
#2
Re: Longs are too small!
Use the Decimal type:
Holds signed 128-bit (16-byte) values representing 96-bit (12-byte) integer numbers scaled by a variable power of 10. The scaling factor specifies the number of digits to the right of the decimal point; it ranges from 0 through 28. With a scale of 0 (no decimal places), the largest possible value is +/-79,228,162,514,264,337,593,543,950,335 (+/-7.9228162514264337593543950335E+28). With 28 decimal places, the largest value is +/-7.9228162514264337593543950335, and the smallest nonzero value is +/-0.0000000000000000000000000001 (+/-1E-28).
They are slower than other numerical types so should be avoided if not required, but if they are required then dive right in.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|