iDevGames Forums
Arbitrary Precision Calculator - Printable Version

+- iDevGames Forums (
+-- Forum: Community Zone (/forum-4.html)
+--- Forum: Assembly Room (/forum-13.html)
+--- Thread: Arbitrary Precision Calculator (/thread-3271.html)

Arbitrary Precision Calculator - unknown - May 26, 2007 04:50 PM

What do you use to do calculations like some number with 1000 decimal places to the power of another?

I've looked at, irb, bc, dc, java etc.. everything seems nasty
Any nice programs which are capable of this?

Arbitrary Precision Calculator - Duane - May 26, 2007 06:09 PM

I wrote one a while back for 128 bit integers, but it has to be ported to ppc if you want to use it on that. But floats are tricky, I stopped with integers.

Arbitrary Precision Calculator - SethWillits - May 26, 2007 09:32 PM

You can do it just like you would in 2nd grade. Line em up and multiply digit by digit over and over.

Arbitrary Precision Calculator - PowerMacX - May 26, 2007 10:34 PM

I haven't used it, but this app claims "1000000 digits" precision:

Edit: a comment pointed to this arbitrary precision calculator:

Arbitrary Precision Calculator - imikedaman - May 26, 2007 10:46 PM

unknown Wrote:What do you use to do calculations like some number with 1000 decimal places to the power of another?
Use "bc" in the Terminal. If you need your program to be able to do these calculations, open a new shell and run a command like this:
echo "5 + 5" | bc
That returns the string "10".

EDIT: Oh, I didn't read your whole post. What's wrong with bc? I use it from time to time; it seems nice.

Arbitrary Precision Calculator - Aressera - May 27, 2007 03:33 AM

You could use java's BigInteger or BigDecimal implementations. They have a large amount of precision (i'm not really sure), but should do the job. But then again, if you have an aversion to java or speed is an issue....

Arbitrary Precision Calculator - martinsm - May 27, 2007 05:19 AM

I'am using Python longs:
>>> 1919191919191919191919L + 10L**30

Arbitrary Precision Calculator - Duane - May 27, 2007 04:07 PM

woot. Gonna put this sucker into my fraction calculator Grin

Arbitrary Precision Calculator - Duane - Jun 1, 2007 01:07 PM

hey, C# has a type called 'BigDecimal,' goes to 28 decimals or something. worked great for me

Arbitrary Precision Calculator - Duane - Jun 3, 2007 02:14 PM

I wrote a bc wrapper for ruby before realizing that for floats, bc uses doubles. Pretty sure, anyhow.

[edit]Ahh, never mind me. you just have to set length and scale, which for some reason, my ruby program chokes and dies on.[/edit]