#include <iostream>
#include <iomanip>
#include <limits>
#include <math.h>
int main(){
double PI = 0;
double Delta = std::numeric_limits<double>::epsilon() * 2;
double k = 0;
while (Delta > std::numeric_limits<double>::epsilon()){
Delta = (4 / (8 * k + 1) - 1 / (4 * k + 2) - 1 / (8 * k + 5) - 1 / (8 * k + 6)) / pow(16.0 ,k);
PI += Delta;
k++;
}
std::cout << std::setprecision(16) << "PI => " << PI << " k => " << k << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4KI2luY2x1ZGUgPGxpbWl0cz4KI2luY2x1ZGUgPG1hdGguaD4KCmludCBtYWluKCl7Cglkb3VibGUgUEkgPSAwOwoJZG91YmxlIERlbHRhID0gc3RkOjpudW1lcmljX2xpbWl0czxkb3VibGU+OjplcHNpbG9uKCkgKiAyOwoJZG91YmxlIGsgPSAwOwoJCgl3aGlsZSAoRGVsdGEgPiBzdGQ6Om51bWVyaWNfbGltaXRzPGRvdWJsZT46OmVwc2lsb24oKSl7CgkJRGVsdGEgPSAoNCAvICg4ICogayArIDEpIC0gMSAvICg0ICogayArIDIpIC0gMSAvICg4ICogayArIDUpIC0gMSAvICg4ICogayArIDYpKSAvIHBvdygxNi4wICxrKTsKCQlQSSArPSBEZWx0YTsKCQlrKys7Cgl9CgoJc3RkOjpjb3V0IDw8IHN0ZDo6c2V0cHJlY2lzaW9uKDE2KSA8PCAiUEkgPT4gIiA8PCBQSSA8PCAiIGsgPT4gIiA8PCBrIDw8IHN0ZDo6ZW5kbDsKCglyZXR1cm4gMDsKCn0=