I'm trying to create a program that receives an expression with floating point numbers and shows if any exceptions occurred.
I know that if I wrote it in C, it would be like this:
#include <stdio.h>
#include <fenv.h>
//floating point math happens before calling the function
void displayExceptions() {
printf("Exception FE_DIVBYZERO: %d\n", fetestexcept(FE_DIVBYZERO));
printf("Exception FE_INEXACT: %d\n", fetestexcept(FE_INEXACT));
printf("Exception FE_INVALID: %d\n", fetestexcept(FE_INVALID));
printf("Exception FE_OVERFLOW: %d\n", fetestexcept(FE_OVERFLOW));
printf("Exception FE_UNDERFLOW: %d\n", fetestexcept(FE_UNDERFLOW));
}
Is there a way to check those exceptions in go?