forked from M-Labs/nac3
1
0
Fork 0

standalone: Do not output sign if float is NaN

Matches behavior in Python.
This commit is contained in:
David Mak 2023-10-09 16:02:15 +08:00
parent e546535df0
commit 630897b779
1 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,4 @@
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
@ -33,7 +34,11 @@ void output_uint64(uint64_t x) {
}
void output_float64(double x) {
printf("%f\n", x);
if (isnan(x)) {
puts("nan");
} else {
printf("%f\n", x);
}
}
void output_asciiart(int32_t x) {