From ff3d8dce5ae157b9b081f153e69aa505cd607d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 29 Dec 2016 13:20:02 +0100 Subject: [PATCH] [apps] Display float in decimal mode in curve views and title Change-Id: I3c069f3e001b43c98d4c54975b02636dad330acf --- apps/curve_view.cpp | 4 ++-- apps/probability/parameters_controller.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/curve_view.cpp b/apps/curve_view.cpp index 63fecc69d..0dc9932df 100644 --- a/apps/curve_view.cpp +++ b/apps/curve_view.cpp @@ -71,11 +71,11 @@ int CurveView::numberOfLabels(Axis axis) const { } void CurveView::computeLabels(Axis axis) { - char buffer[Constant::FloatBufferSizeInScientificMode]; + char buffer[Constant::FloatBufferSizeInDecimalMode]; float step = gridUnit(axis); for (int index = 0; index < numberOfLabels(axis); index++) { // TODO: change the number of digits in mantissa once the numerical mode is implemented - Float(2.0f*step*(ceilf(min(axis)/(2.0f*step)))+index*2.0f*step).convertFloatToText(buffer, Constant::FloatBufferSizeInScientificMode, Constant::NumberOfDigitsInMantissaInScientificMode); + Float(2.0f*step*(ceilf(min(axis)/(2.0f*step)))+index*2.0f*step).convertFloatToText(buffer, Constant::FloatBufferSizeInDecimalMode, Constant::NumberOfDigitsInMantissaInDecimalMode, Float::DisplayMode::Decimal); //TODO: check for size of label? strlcpy(label(axis, index), buffer, strlen(buffer)+1); } diff --git a/apps/probability/parameters_controller.cpp b/apps/probability/parameters_controller.cpp index 0552a23ff..7548f40ee 100644 --- a/apps/probability/parameters_controller.cpp +++ b/apps/probability/parameters_controller.cpp @@ -106,8 +106,8 @@ void ParametersController::updateTitle() { m_titleBuffer[currentChar++] = m_law->parameterNameAtIndex(index)[0]; strlcpy(m_titleBuffer+currentChar, " = ", 4); currentChar += 3; - char buffer[Constant::FloatBufferSizeInScientificMode]; - Float(m_law->parameterValueAtIndex(index)).convertFloatToText(buffer, Constant::FloatBufferSizeInScientificMode, Constant::NumberOfDigitsInMantissaInScientificMode); + char buffer[Constant::FloatBufferSizeInDecimalMode]; + Float(m_law->parameterValueAtIndex(index)).convertFloatToText(buffer, Constant::FloatBufferSizeInDecimalMode, Constant::NumberOfDigitsInMantissaInDecimalMode, Float::DisplayMode::Decimal); strlcpy(m_titleBuffer+currentChar, buffer, strlen(buffer)+1); currentChar += strlen(buffer); m_titleBuffer[currentChar++] = ' ';