円周率

ぼーーーー( ゚ ρ ゚ )

#include <pstade/oven/generation.hpp>
#include <pstade/oven/algorithm.hpp>
#include <pstade/oven/regular.hpp>
#include <cmath>
#include <cstdio>

struct generator
{
	typedef double result_type;
	result_type operator()() const
	{
		a_ += 1.0;
		return a_;
	}
	generator() : a_(0.) {}

private:
	mutable double a_;
};

struct integral
 {
 	integral() : s_(0.) {}
	void operator()(double a) const {
		s_ += 1./pow(a,2.);
		printf("%12.10f\n", sqrt(s_ * 6.));
	}

 	mutable double s_;
};

int main()
{
	using namespace pstade::oven;
	namespace bll = boost::lambda;
	for_each(generation(nonstop(regular_ref(generator()))), integral());
}

追記。
からしばらく回していたら、3.14159264497820から増えなくなりました
pi=3.14159265358979323846...なので
pi - 3.14159264497820 〜 0.00000000861159323846
3.14159264497820/pi 〜 0.99999999725884473640469608013103 〜 99.9999997%