#define MAX_ITERATIONS 100000
#define PI_t 3.14159265359
#include <stdio.h>
#include <stdlib.h>
#include "pico/float.h"
#include "pico/double.h"
/**
* @brief Print pi to the console
*
* @return int Application return code (zero for success).
*/
/**
* @brief Computes pi using the Wallis Product using single-precision
*
* @param n The amount of terms to sum
*
* @return float pi (calculates using Wallis Product
*/
float wallis_product_float(int n) {
float pi = 1.0;
for (int i = 1; i <= n; i++) {
float two_n = 2.0 * (float) i;
pi *= (two_n / (two_n - 1.0)) * (two_n / (two_n + 1.0));
}
return pi * 2.0;
}
/**
* @brief Computes pi using the Wallis Product using double-precision
*
* @param n The amount of terms to sum
*
* @return double pi (calculates using Wallis Product
*/
double wallis_product_double(int n) {
double pi = 1.0;
for (int i = 1; i <= n; i++) {
double two_n = 2.0 * (double) i;
pi *= (two_n / (two_n - 1.0)) * (two_n / (two_n + 1.0));
}
return pi * 2.0;
}
int main() {
// stdio_init_all();
while (true) {
printf("Hello, world!\n");
sleep_ms(1000);
}
// Returning zero indicates everything went okay.
return 0;
}