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 50230e61f3
commit 24d99830ae
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) {