-
-
Save jcreedcmu/905b9b880d40a66a420de0bdba66b106 to your computer and use it in GitHub Desktop.
a.c
This file contains 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
#include <stdio.h> | |
#define GOOD1 99586915107664152904966939075856564224.0 | |
#define GOOD2 298759386401549014052982412761733529600.0 | |
#define BAD 298759406683958617704652836708984815616.0 | |
int isGood(float x) { | |
return 1.0 / (1.0 / x) == x; | |
} | |
float disc(float x) { | |
return 1.0 / (1.0 / x) - x; | |
} | |
int main() { | |
printf("%d\n", isGood(GOOD1)); | |
printf("%d\n", isGood(GOOD2)); | |
printf("%d\n", isGood(BAD)); | |
printf("%f\n", disc(BAD)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment