From 29b4aa20ae2a75808adbea63373a7f6c21ac9441 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 14 Feb 2026 16:18:37 -0500 Subject: Bugfix for printing negative ints --- src/stdlib/print.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/stdlib') diff --git a/src/stdlib/print.c b/src/stdlib/print.c index 7da1343f..71ad4750 100644 --- a/src/stdlib/print.c +++ b/src/stdlib/print.c @@ -14,6 +14,7 @@ int _print_int(FILE *f, int64_t n) { char buf[21] = {[20] = 0}; // Big enough for INT64_MIN + '\0' char *p = &buf[19]; bool negative = n < 0; + if (negative) n = -n; do { *(p--) = '0' + (n % 10); -- cgit v1.2.3