From 94434815bacddc2fb7ee4cb3ecb398dabbf13dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Fri, 19 Apr 2019 14:45:33 +0200 Subject: [PATCH] [poincare/print_int] Fix printInt --- poincare/src/print_int.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/poincare/src/print_int.cpp b/poincare/src/print_int.cpp index 8a88e2147..7c6d5eade 100644 --- a/poincare/src/print_int.cpp +++ b/poincare/src/print_int.cpp @@ -6,12 +6,12 @@ namespace Poincare { bool PrintInt::PadIntInBuffer(int integer, char * buffer, int bufferLength) { assert(integer >= 0); - int wantedLength = std::log10(integer); + int wantedLength = std::log10(integer*1.0); if (wantedLength > bufferLength) { return false; } for (int i = 0; i < bufferLength; i++) { - buffer[i] = '0' + ((int)(integer/std::pow(10, bufferLength - 1 - i))) - ((int)(integer/std::pow(10, bufferLength-i)))*10; + buffer[i] = '0' + ((int)(integer/std::pow(10.0, bufferLength - 1.0 - i))) - ((int)(integer/std::pow(10.0, bufferLength-i)))*10; } return true; }