mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps] Clean convertFloatToText uses
This commit is contained in:
@@ -181,8 +181,10 @@ void CalculationController::willDisplayCellAtLocation(HighlightCell * cell, int
|
||||
if (field->isEditing()) {
|
||||
return;
|
||||
}
|
||||
char buffer[PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)];
|
||||
PrintFloat::convertFloatToText<double>(m_calculation->parameterAtIndex(i-1), buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, Preferences::PrintFloatMode::Decimal);
|
||||
constexpr int precision = Constant::LargeNumberOfSignificantDigits;
|
||||
constexpr int bufferSize = PrintFloat::bufferSizeForFloatsWithPrecision(precision);
|
||||
char buffer[bufferSize];
|
||||
PrintFloat::convertFloatToText<double>(m_calculation->parameterAtIndex(i-1), buffer, bufferSize, precision, Preferences::PrintFloatMode::Decimal);
|
||||
field->setText(buffer);
|
||||
}
|
||||
}
|
||||
@@ -282,9 +284,10 @@ void CalculationController::updateTitle() {
|
||||
if (currentChar >= k_titleBufferSize) {
|
||||
break;
|
||||
}
|
||||
constexpr size_t bufferSize = PrintFloat::bufferSizeForFloatsWithPrecision(Constant::ShortNumberOfSignificantDigits);
|
||||
constexpr int precision = Constant::ShortNumberOfSignificantDigits;
|
||||
constexpr size_t bufferSize = PrintFloat::bufferSizeForFloatsWithPrecision(precision);
|
||||
char buffer[bufferSize];
|
||||
PrintFloat::convertFloatToText<double>(m_law->parameterValueAtIndex(index), buffer, bufferSize, Constant::ShortNumberOfSignificantDigits, Preferences::PrintFloatMode::Decimal);
|
||||
PrintFloat::convertFloatToText<double>(m_law->parameterValueAtIndex(index), buffer, bufferSize, precision, Preferences::PrintFloatMode::Decimal);
|
||||
currentChar += strlcpy(m_titleBuffer+currentChar, buffer, k_titleBufferSize - currentChar);
|
||||
if (currentChar >= k_titleBufferSize) {
|
||||
break;
|
||||
|
||||
@@ -57,6 +57,7 @@ void BoxController::reloadBannerView() {
|
||||
double calculation = (m_store->*calculationMethods[selectedQuantile])(selectedSeriesIndex());
|
||||
int numberOfChar = PoincareHelpers::ConvertFloatToText<double>(calculation, buffer, bufferSize - 1, Constant::LargeNumberOfSignificantDigits);
|
||||
buffer[numberOfChar++] = ' ';
|
||||
assert(numberOfChar <= bufferSize - 1);
|
||||
buffer[numberOfChar] = 0;
|
||||
m_view.bannerView()->calculationValue()->setText(buffer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user