08-15-2022, 09:35 PM
(This post was last modified: 08-15-2022, 09:35 PM by Kernelpanic.)
|
Just finished calculating pi to 30 trillion places.
|
|
Kernelpanic
Ramanujan’s Formula for Pi would go something like this, consider it pseudo-code Code: (Select All) pie=0
08-15-2022, 11:02 PM
(08-15-2022, 10:23 PM)Jack Wrote: Kernelpanic Nice work at applying the formula, Jack. It works up to 8 iterations before the binary computer math breaks it. Makes me with I had powers and square roots coded for my routine. I'll hang on to this for some time in the future. Pete
08-16-2022, 12:21 AM
the simplest and fast way to calculate pi is to use the Gauss–Legendre algorithm https://en.wikipedia.org/wiki/Gauss%E2%8..._algorithm
the Pi - Chudnovsky with binary splitting is much faster here's a version in FreeBasic https://www.freebasic.net/forum/viewtopi...85#p178885 all calculations need to be performed to full precision Code: (Select All) digits=100
08-16-2022, 12:56 AM
(08-15-2022, 08:43 PM)Pete Wrote:(08-15-2022, 07:28 PM)JRace Wrote: @KernelPanic: the first constant: Yeah, looks like a precision issue, but the location of the discrepancy strikes me as odd.
08-16-2022, 01:25 AM
(08-16-2022, 12:21 AM)Jack Wrote: the simplest and fast way to calculate pi is to use the Gauss–Legendre algorithm https://en.wikipedia.org/wiki/Gauss%E2%8..._algorithm @Jack I can't say I'm a fan of this one. Digits variable at 100 runs 6 iterations. I tried other iterations with less accurate or completely skewed results. So the... Code: (Select All) fix(log(digits)*1.44269504088896)...is lost on me. at digits = 100 the output was: 3.141697. Is there any way to get that more accurate and produce more digits? Pete
Pete, that should work but you need to perform all calculations to digits accuracy
there's a quartic version of the Gauss–Legendre algorithm for Pi, that is the accuracy quadruples on each iteration, but I find that's a bit slower https://en.wikipedia.org/wiki/Approximat...algorithms the quartic version would be something like the following Code: (Select All) y=2 : y=sqr(y)
08-16-2022, 12:30 PM
A really nice and quick one is this one:
Code: (Select All) $Console:Only
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience
08-16-2022, 01:43 PM
Pete, you could adapt this code https://qb64forum.alephc.xyz/index.php?P...#msg133377
08-16-2022, 05:11 PM
(This post was last modified: 08-16-2022, 05:12 PM by Kernelpanic.)
|
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads… | |||||
| Thread | Author | Replies | Views | Last Post | |
| calculating ratios to find optimal grid layout | madscijr | 16 | 2,611 |
02-21-2025, 10:24 PM Last Post: madscijr |
|
| Searching sateliet calculating position program. | Rudi59 | 4 | 1,224 |
09-20-2024, 10:50 PM Last Post: Rudi59 |
|
| Calculating with complex numbers | Kernelpanic | 5 | 1,410 |
07-07-2022, 10:44 AM Last Post: triggered |
|
Users browsing this thread:


![[Image: Kama-BSP2022-08-15-232612.jpg]](https://i.ibb.co/5F7fwQp/Kama-BSP2022-08-15-232612.jpg)
![[Image: 2022-08-15-141747.png]](https://i.ibb.co/pvKY8zZ/2022-08-15-141747.png)


![[Image: Jack-PI-2022-08-16-185207.jpg]](https://i.ibb.co/0B3SCj6/Jack-PI-2022-08-16-185207.jpg)