From 9fbfe1c5dcb12c47e6a408818dc815e3dd856518 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 23 Sep 2019 11:45:11 +0200 Subject: printf_float: Fix output errors caused by cast to signed int --- src/os/object/outputstream.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/os') diff --git a/src/os/object/outputstream.cc b/src/os/object/outputstream.cc index 4359874..fe4ec7f 100644 --- a/src/os/object/outputstream.cc +++ b/src/os/object/outputstream.cc @@ -178,18 +178,18 @@ void OutputStream::printf_float(float num) num *= -1; } if (num > 1000) { - put('0' + (((int)num % 10000) / 1000)); + put('0' + (((unsigned int)num % 10000) / 1000)); } if (num > 100) { - put('0' + (((int)num % 1000) / 100)); + put('0' + (((unsigned int)num % 1000) / 100)); } if (num > 10) { - put('0' + (((int)num % 100) / 10)); + put('0' + (((unsigned int)num % 100) / 10)); } - put('0' + ((int)num % 10)); + put('0' + ((unsigned int)num % 10)); put('.'); - put('0' + ((int)(num * 10) % 10)); - put('0' + ((int)(num * 100) % 10)); + put('0' + ((unsigned int)(num * 10) % 10)); + put('0' + ((unsigned int)(num * 100) % 10)); } // FLUSH -- cgit v1.2.3