For a change
Reinhard
Posts: 489
What outputs this programm ?
Don't think to hard about it, if you run it you get a surprise.
But don't ask me for an explanation ;-)
Reinhard
#include <cstdlib> #include <complex> #include <stdio.h> using namespace std; int main(int argc, char *argv[]) { double epsilon = 0.0000002; complex<double>Z (0,0); complex<double>C (-0.75,epsilon); int iter; for (iter = 1 ; iter < 400000000; iter++) { Z = Z * Z + C; if(abs(Z) > 2) { printf("%f\n",(double)(epsilon * (double)iter)); break; } } return EXIT_SUCCESS; } // propeller-elf-g++ -mxmmc -o i.elf p.cpp
Don't think to hard about it, if you run it you get a surprise.
But don't ask me for an explanation ;-)
Reinhard
Comments
What the significance of the printed value is I have no idea.
Bingo! https://home.comcast.net/~davejanelle/mandel.html
this is the slowest method to generate PI, that I know.
But is a mystery in math since 1991.
I do not know a waterproofed explanation.
Reinhard
A lucky guess on my part, but still very interesting.