Created
April 25, 2022 16:04
-
-
Save nathanjackson/9462e0a1a5f481bac6aac4a996c1ca76 to your computer and use it in GitHub Desktop.
floating point exception example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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