ref: faf4d16a06726e00ca9997479421f9fd13157e51
parent: 4f9c037b5e4354e9670d79f83a584a64fa79376d
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Mon Feb 5 16:20:31 EST 2024
Nicer inf & nan
--- a/src/runtime/eval.c
+++ b/src/runtime/eval.c
@@ -1507,9 +1507,10 @@
* 17 would keep the precision, but it frequently looks very ugly.
*/
(void)snprintf(str, 25, "%.16g", x);
- if (!strchr(str, '.') && !strchr(str, 'e') && !strchr(str, 'E')) {+ if (strcmp(str, "nan") != 0 && strcmp(str, "-nan") != 0 &&
+ strcmp(str, "inf") != 0 && strcmp(str, "-inf") != 0 &&
+ !strchr(str, '.') && !strchr(str, 'e') && !strchr(str, 'E')) {/* There is no decimal point and no exponent, so add a decimal point */
- /* XXX wrong for inf and NaN */
strcat(str, ".0");
}
}
--
⑨