Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Just finished calculating pi to 30 trillion places.
#30
(09-11-2022, 01:48 AM)Pete Wrote: I kept a beta version of it that prints out what it is doing. I'm thinking I might post it in a new discussion thread on string math division. Basically what I did was to shortcut zero and 1 divisors, chop out leading zeros in small decimal numbers making less digits to calculate, estimate the mult loop by using just the first one or two digits of the divisor and the dividend or remainder so it usually only takes two tries to get the right multiplier before subtracting to obtain the remainder and, of course, working with chunks of numbers with multiplication and subtraction in the long division process.

I knew it would be faster, I'm just amazed it's so much faster.

Now I'm wondering how much faster it could be if I switched from string concatenation to fixed string replacement? I did that once with a c keyboard WP routine (about the only complicated C/C++ prog I've ever written) and the speed increase was pretty impressive. Converting for string math might be a bit of a challenge, and if too many conditions need to be added, it might end up being a push.

The only miss I had on this new routine was the bloat of about 40 more lines than my previous division code. I really wanted to do this one in about the same number of lines but no dice. In contrast, I think I cut code in both the multiplication and add/subtract routines.

Thanks,

Pete
@Pete Hmm, that sounds pretty straight-forward! I was gunna try that next! Tongue
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply


Messages In This Thread
RE: Just finished calculating pi to 30 trillion places. - by PhilOfPerth - 09-11-2022, 02:31 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  calculating ratios to find optimal grid layout madscijr 16 2,615 02-21-2025, 10:24 PM
Last Post: madscijr
  Searching sateliet calculating position program. Rudi59 4 1,227 09-20-2024, 10:50 PM
Last Post: Rudi59
  Calculating with complex numbers Kernelpanic 5 1,421 07-07-2022, 10:44 AM
Last Post: triggered

Forum Jump:


Users browsing this thread: