forked from M-Labs/nac3
standalone: Do not output sign if float is NaN
Matches behavior in Python.
This commit is contained in:
parent
e546535df0
commit
630897b779
|
@ -1,3 +1,4 @@
|
||||||
|
#include <math.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -33,8 +34,12 @@ void output_uint64(uint64_t x) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void output_float64(double x) {
|
void output_float64(double x) {
|
||||||
|
if (isnan(x)) {
|
||||||
|
puts("nan");
|
||||||
|
} else {
|
||||||
printf("%f\n", x);
|
printf("%f\n", x);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void output_asciiart(int32_t x) {
|
void output_asciiart(int32_t x) {
|
||||||
static const char *chars = " .,-:;i+hHM$*#@ ";
|
static const char *chars = " .,-:;i+hHM$*#@ ";
|
||||||
|
|
Loading…
Reference in New Issue