mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[poincare] Fix Decimal serialization
This commit is contained in:
@@ -195,11 +195,13 @@ int DecimalNode::convertToText(char * buffer, int bufferSize, Preferences::Print
|
||||
return currentChar;
|
||||
}
|
||||
/* Case 1: Decimal mode */
|
||||
assert(UTF8Decoder::CharSizeOfCodePoint('.') == 1);
|
||||
assert(UTF8Decoder::CharSizeOfCodePoint('0') == 1);
|
||||
int deltaCharMantissa = exponent < 0 ? -exponent+1 : 0;
|
||||
strlcpy(buffer+currentChar+deltaCharMantissa, tempBuffer, maxInt(0, bufferSize-deltaCharMantissa-currentChar));
|
||||
if (exponent < 0) {
|
||||
for (int i = 0; i <= -exponent; i++) {
|
||||
currentChar += SerializationHelper::CodePoint(buffer + currentChar, bufferSize - currentChar, i == 1 ? '.' : '0');
|
||||
buffer[currentChar++] = i == 1 ? '.' : '0';
|
||||
if (currentChar >= bufferSize-1) { return bufferSize-1; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user