News Feed
Jobs Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Tobias Schlitt's Blog:
Randomized Pi calculation
April 02, 2007 @ 10:04:00

Since there is no "magic variable" to get a value for Pi in an application, Tobias Schlitt offers up the next best thing - his homegrown solution for creating the value (using a randomized variation).

I don't know which is the most common way to calculate Pi in computer programs, but from the stochastics book a read for my recent stochastics exam, I have a randomized variation, which is quite cool I think.

The code example is included along with a bit of explanation for those not familiar with the concepts behind it. It uses two of PHP functions, pow() and mt_rand(), to run through a series of iterations and, using a preset precision value, find the "hits" to finally calculate the value at the end.

1 comment voice your opinion now!
randomize pi calculation pow mtrand precision randomize pi calculation pow mtrand precision


WebDevLogs:
PHP Calculate PI
January 25, 2007 @ 09:29:00

Mgccl let us know about a new bit of functionality he's worked up to calculate a higher precision value of Pi than the built-in PHP function can.

I want to release some Benchmark system can be uploaded to any web host and check how good the web hosting is. Pi (') calculations spread widely as one of the most popular CPU benchmark system, that's why I have created a Pi calculator that can get to the accuracy you want. For now, there is still one thing I'm not sure yet, I will explain it after show you the code.

The function is provided (that takes in the precision value you want) and a brief explanation of what it does differently and a reason why to use it over the built-in function.

0 comments voice your opinion now!
calculate pi percision machins formula taylor series calculate pi percision machins formula taylor series



Community Events











Don't see your event here?
Let us know!


unittest application composer opinion podcast security example symfony2 facebook overview package install hhvm release introduction component framework language hack code

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework