Skip to content

Instantly share code, notes, and snippets.

@nathanjackson
Created April 25, 2022 16:04
Show Gist options
  • Save nathanjackson/9462e0a1a5f481bac6aac4a996c1ca76 to your computer and use it in GitHub Desktop.
Save nathanjackson/9462e0a1a5f481bac6aac4a996c1ca76 to your computer and use it in GitHub Desktop.
floating point exception example
#define _GNU_SOURCE
#include <stdio.h>
#include <fenv.h>
int main()
{
feenableexcept(FE_DIVBYZERO);
double x = 12.34;
double y = 0.0;
double z = x / y;
printf("%f\n", z);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment