|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
|
|
|
@ -19,7 +20,12 @@ double approximate_pi(unsigned int steps) {
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
// printf("sizeof(int) = %d\n", sizeof(int));
|
|
|
|
// printf("sizeof(int) = %d\n", sizeof(int));
|
|
|
|
printf("pi = %8.7f\n", approximate_pi(10000000));
|
|
|
|
|
|
|
|
|
|
|
|
double mypi = approximate_pi(100000000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("pi = %8.7f\n", mypi);
|
|
|
|
|
|
|
|
assert(mypi > 3.141);
|
|
|
|
|
|
|
|
assert(mypi < 3.142);
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|