While playing with my code, I learned that toFixed goes out only to 20. How did I miss that, and, more importantly, WHAT IS THE POINT!? I wanted to take Pi out further. I don’t like to be limited with pie or Pi. Other than hardcoding the first 100 decimal places, how would I do it?
I looked at Leibniz formula:
I kept increasing i. The more iterations, the more accurate. See my problem there? If I just do i=5000, then it doesn’t even come out to 3.14159, the digits most people remember. When I’d take it out to i=1000000000, it was more accurate, but the program was slower. And I still couldn’t get it to show more than 20 decimal places. I downloaded some libraries to help (bigdecimal, decimal), but I am still stymied.
I learned plenty, but I also learned that I’ll let the computer limit the user and change the system. I also added validation codes. I might know what numbers to enter, but I have to remember to code for weenies out there.
A lot learned. I’m sorry that I can’t do the Leibniz version. That was fun. I’ve kept it in the code but commented out for when I’m alone at night and want to nibble on German pi while ogling this sex machine: