Skip to content

Instantly share code, notes, and snippets.

@jcreedcmu
Created March 1, 2019 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcreedcmu/905b9b880d40a66a420de0bdba66b106 to your computer and use it in GitHub Desktop.
Save jcreedcmu/905b9b880d40a66a420de0bdba66b106 to your computer and use it in GitHub Desktop.
a.c
#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