1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Solaris17's PI project.

Discussion in 'Programming & Webmastering' started by Solaris17, Jun 7, 2008.

  1. Solaris17

    Solaris17 Creator Solaris Utility DVD

    Joined:
    Aug 16, 2005
    Messages:
    17,421 (5.09/day)
    Thanks Received:
    3,719
    Location:
    Florida
    Hey guys i wanted to make a pi program in C++ that didnt have a limit so i can publish it on tpu i wanted to make it so people didnt have a 32m digit limit i thought it would be kinda fun i have a really rough alpha and i was wondering if anyone could help me id obviously give credit were its due..its just that my C++ skills are a tad more than lacking and compiling it to an .exe is impossible as i cant figure out how to even do that..so if anyone wants me to shoot them the code that would be a great help thanks much!
     
  2. Oliver_FF

    Oliver_FF New Member

    Joined:
    Oct 15, 2006
    Messages:
    546 (0.18/day)
    Thanks Received:
    65
    Yeah sure, I'll help you out - as long as you know how to compute Pi to XXX decimal places, that is ;)
     
    Solaris17 says thanks.
  3. DanTheBanjoman SeƱor Moderator

    Joined:
    May 20, 2004
    Messages:
    10,553 (2.72/day)
    Thanks Received:
    1,383
    No offense Solaris, but you keep trying to overdo everything. If you don't even know how to compile your code you should start there. Play around, learn how the basics work. Once you actually know what you're doing think about publishing something.
     
  4. DaedalusHelios

    DaedalusHelios

    Joined:
    Feb 21, 2008
    Messages:
    4,965 (1.98/day)
    Thanks Received:
    826
    Location:
    Greensboro, NC, USA
    Are you certified Solaris?
     
  5. Oliver_FF

    Oliver_FF New Member

    Joined:
    Oct 15, 2006
    Messages:
    546 (0.18/day)
    Thanks Received:
    65
    One of my old friends, total genius (got 100% on TWO as-level physics papers :twitch:) tried something like this, it turns out it's a little harder than you first think...

    Mainly because you need to create your own data structures to hold so many digits - and then you need to write functions to perform maths operations on your structures... Programming long division is dire, believe me haha
     
    Solaris17 says thanks.
  6. Solaris17

    Solaris17 Creator Solaris Utility DVD

    Joined:
    Aug 16, 2005
    Messages:
    17,421 (5.09/day)
    Thanks Received:
    3,719
    Location:
    Florida
    ya i guess your right dan i should probably work on it more.......well i guess ill do that then once i understand how things work a little bit better ill let you guys know!!!!

    thank though oliver.
     
  7. Jizzler

    Jizzler

    Joined:
    Aug 10, 2007
    Messages:
    3,466 (1.28/day)
    Thanks Received:
    650
    Location:
    Geneva, FL, USA
    PHP:
    bcscale(10000);

    $pi $n 4;
    for (
    $d 3$d <= 5000$d+= 2) {
        
    $pi bcadd($pibcdiv(($n=$n*-1), $d));
    }

    echo 
    '<pre>',chunk_split($pi),'</pre>';
    Euler's is easy, though not terribly accurate. Took 5000 iterations to get a couple good digits ;)

    Code:
    3.14119265360579323526264494487808464626650513117799509139232716327663420688
    4740267244039722655469412735889598932352008365373760263570818925607541994079
    6721882831034784671840110273983943534903577555995445382042580984985109816...
    Much better ways are the algorithms from Ramanujan and Chudnovsky. Started to write one out as a coding exercise for myself, didn't finish though. Not that I'm suggesting that my code would rival the already existing PI calc programs, just something to play around with.
     
    Solaris17 says thanks.
  8. Oliver_FF

    Oliver_FF New Member

    Joined:
    Oct 15, 2006
    Messages:
    546 (0.18/day)
    Thanks Received:
    65
    You could use:

    Pi = 4 * (arctan(1/2) + arctan(1/3))

    to get a perfect answer, but arctan would be horrific to program :laugh:
     
    Solaris17 says thanks.
  9. Kreij

    Kreij Senior Monkey Moderator Staff Member

    Joined:
    Feb 6, 2007
    Messages:
    13,881 (4.81/day)
    Thanks Received:
    5,619
    Location:
    Cheeseland (Wisconsin, USA)
    Solaris,
    You may seriously want to try Microsoft's tools.
    To compile to a .exe all you have to do is click a button. :toast:
     
    Solaris17 says thanks.
  10. Solaris17

    Solaris17 Creator Solaris Utility DVD

    Joined:
    Aug 16, 2005
    Messages:
    17,421 (5.09/day)
    Thanks Received:
    3,719
    Location:
    Florida
    ok thanks guys ill give it a go thanks for the support and thanks dan for the wise advice :) ill let everyone know.
     

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page