Skip to content

Incorrect benchmark for airy/MAX/eq? #10

@Qi-Zhan

Description

@Qi-Zhan

The NAN in double may cause the inconsistency in the benchmark:

#include <math.h>
#include <stdio.h>
double snippet1(double a, double b) {
  if (b < a)  // change
    return a; // change
  else
    return b; // change
}

double snippet2(double a, double b) {
  if (b > a)
    return b;
  else
    return a;
}

int main() {
  double a = 1.25 * 256;
  double b = NAN; // 0x7fc00000
  double x = snippet1(a, b);
  double y = snippet2(a, b);
  printf("%f, %f\n", x, y);
  return 0;
}

It turns out that x = nan, y = 320.000000.

I suggest change the type from double to int.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions