Calculating the first 1000 digits of pi

Discussion in 'Spigot Plugin Development' started by Mr.Midnight, Jun 18, 2016.

  1. Ello I am trying to make a Pi calculator for my server, how can I implement such an algorithm?
  2. Math.PI :p
    • Funny Funny x 2
    • Winner Winner x 1
  3. "First 1000 digits of pi"
  4. Such small ambitions
    • Agree Agree x 2
    • Funny Funny x 1
  5. Maybe you could do a algorithum that manually does division, sort of like how you would do long division,

    isnt pi like a circumference / diameter of a circle?

    Than stop the algorithum if it goes 1000 times
  6. Choco


    Doesn't double data type only limit to 15 decimal places?
  7. BigDecimal?
  8. Choco


    Yea I suppose so. Wait; what do you need 1,000 units of Pi for anyways? Rounding to 15 digits should suffice and get you a pretty spot on answer
    • Agree Agree x 1
    • Funny Funny x 3
    • Useful Useful x 1
  9. I thought it would be a fun addition for my players to be able to calculate pi.
  10. Sorry I am not the best at math either :C
  11. Just make a algorithum that does long division steps 1000 times, get a circumference and diameter of a random circle. then put it in that algorithum m9,

    isnt long division like:

    check how much times a number can go into another, than you put it on top, than u multiply, than you subtract it from the numbers ur dealing with, than u take the remaining and move on or something xD
  12. what happens if you put a never ending decimal division in java? does it crash?
    • Creative Creative x 1
  13. Dunn... Dunnnnn... Dunnnnna D:
  14. I doubt that. Probably would throw an exception though.

    Edit: You could do it with something like the Nilakantha series.
  15. It'd throw an exception. Java doesn't allow developers to do stupid things ;(
    • Agree Agree x 1
    • Funny Funny x 1
  16. So making a long division algorithm to get the first 1000 digits seems the best way.
  17. Pi is the circumference of a circle with 1 unit diameter.

    Basically, if you have a wheel and it's 1 meter in diameter, the circumference would be Pi meters.

    Thus, the equation for circumference is 2πr (2 * pi * radius)


    But to answer the original question... See this link:
    #20 BillyGalbreath, Jun 18, 2016
    Last edited: Jun 18, 2016
    • Agree Agree x 1