Skip to content

Instantly share code, notes, and snippets.

@cosinekitty
Last active June 10, 2020 01:14
Show Gist options
  • Select an option

  • Save cosinekitty/1d482ea4fea7a039275afdf0ca4593c7 to your computer and use it in GitHub Desktop.

Select an option

Save cosinekitty/1d482ea4fea7a039275afdf0ca4593c7 to your computer and use it in GitHub Desktop.

Revisions

  1. cosinekitty revised this gist Jun 10, 2020. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion bogus.c
    Original file line number Diff line number Diff line change
    @@ -11,9 +11,10 @@ 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: diff = %lf\n", diff);
    printf("FAIL\n");
    return 1;
    }
    printf("PASS\n");
  2. cosinekitty created this gist Jun 10, 2020.
    21 changes: 21 additions & 0 deletions bogus.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #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);
    if (diff > 1.0e-12)
    {
    printf("FAIL: diff = %lf\n", diff);
    return 1;
    }
    printf("PASS\n");
    return 0;
    }