PartyMTA Posted June 17, 2014 Posted June 17, 2014 hi,i made this little script with the method of Archimedes to calculate the Pi. function getPi(commandName,number) calc = number*math.sin(0.5/number) outputChatBox(calc) end addCommandHandler("pi",getPi) Command: /pi (number) change (number) to the wished number. Without ()! its actually easy to make this. i just was bored
Saml1er Posted June 17, 2014 Posted June 17, 2014 function getPi(commandName,number) number = tonumber ( number ) if number then -- if we converted it into a number then lets proceed ..... calc = number*math.sin(0.5/number) outputChatBox(calc) end end addCommandHandler("pi",getPi) Well good luck. Your efforts are always appreciated.
MIKI785 Posted June 17, 2014 Posted June 17, 2014 What about this? math.pi Isnt that actually the same?
50p Posted June 17, 2014 Posted June 17, 2014 I'm confused. What's the point of this script? Why calculate pi? How are you going to calculate pi by passing a number to the command? print( math.pi ); -- or if accuracy isn't that important to you: print( 22/7 );
PartyMTA Posted June 17, 2014 Author Posted June 17, 2014 What about this? math.pi Isnt that actually the same? That will go up to 13 decimals, this code will go to ~15 decimals
PartyMTA Posted June 17, 2014 Author Posted June 17, 2014 I'm confused. What's the point of this script? Why calculate pi? How are you going to calculate pi by passing a number to the command? print( math.pi ); -- or if accuracy isn't that important to you: print( 22/7 ); i just was bored
50p Posted June 17, 2014 Posted June 17, 2014 Still, How are you going to calculate pi by passing a number to the command?
ixjf Posted June 17, 2014 Posted June 17, 2014 Wasn't that pointless function "binary" you placed all over the wiki while you attempted to "hack" the wiki enough?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now