From a587d352d131c629afabaf9275304b33b6eb1246 Mon Sep 17 00:00:00 2001 From: cousteau Date: Sun, 7 Feb 2016 04:11:52 +0100 Subject: [PATCH] Print negative numbers as negative numbers regardless of base Make negative integers be represented with "-" in any base, not just base 10. --- hardware/arduino/avr/cores/arduino/Print.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hardware/arduino/avr/cores/arduino/Print.cpp b/hardware/arduino/avr/cores/arduino/Print.cpp index bc97c851f2f..971725c0abb 100644 --- a/hardware/arduino/avr/cores/arduino/Print.cpp +++ b/hardware/arduino/avr/cores/arduino/Print.cpp @@ -88,14 +88,12 @@ size_t Print::print(long n, int base) { if (base == 0) { return write(n); - } else if (base == 10) { + } else { if (n < 0) { int t = print('-'); n = -n; - return printNumber(n, 10) + t; + return printNumber(n, base) + t; } - return printNumber(n, 10); - } else { return printNumber(n, base); } }