Elements 6.1.2
A C++ base framework for the Euclid Software.
Loading...
Searching...
No Matches
PiCalculator.cpp
Go to the documentation of this file.
1
19
20namespace Elements {
21namespace Examples {
22
23void PiCalculator::calculate(unsigned int terms) {
24
25 double pi = 0.0;
26 // Leibniz formula for pi
27 double numerator = -1.0;
28 double denominator = -1.0;
29
30 for (unsigned int ii = 0; ii < terms; ++ii) {
31 numerator *= -1;
32 denominator += 2.0;
33 pi += numerator / denominator;
34 }
35
36 pi *= 4.0;
37
39}
40
41void PiCalculator::setShowResultCallback(show_result_callback_type f) {
42
44}
45
46} // namespace Examples
47} // namespace Elements
show_result_callback_type m_show_result_callback
Definition: PiCalculator.h:41
void calculate(unsigned int terms)
void setShowResultCallback(show_result_callback_type f)