Last active
June 10, 2020 01:14
-
-
Save cosinekitty/1d482ea4fea7a039275afdf0ca4593c7 to your computer and use it in GitHub Desktop.
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> | |
#include <math.h> | |
double Distance(double x, double y) | |
{ | |
/* Intentional bug for illustration... */ | |
return sqrt(-1.0); | |
} | |
int main() | |
{ | |
double r = Distance(3.0, 4.0); | |
double diff = fabs(r - 5.0); | |
printf("diff = %lf\n", diff); | |
if (diff > 1.0e-12) | |
{ | |
printf("FAIL\n"); | |
return 1; | |
} | |
printf("PASS\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment