Thanks! I tried to run the following code on my Apple Silicon machine and got the expected output. Using the standard library to detect the signs of the nan value is the possible way to make the test platform agnostic. I’m going to try to update the MLIR C runner util too.
#include <stdio.h>
#include <cmath>
void printF32(float f)
{
if (std::isnan(f) && std::signbit(f)) {
fprintf(stdout, "-nan\n");
} else {
fprintf(stdout, "%g\n", f);
}
}
int main()
{
const float nan = 0.0/0.0;
printF32(nan);
const float neg_nan = -nan;
printF32(neg_nan);
const float small_value = 5.96046e-08;
printF32(small_value);
}
./a.out
nan
-nan
5.96046e-08