mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix: Correct precision calculation for floating point formatting (#2657)
* Fix: Correct precision calculation for floating point formatting --------- Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com> Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
This commit is contained in:
@@ -364,7 +364,10 @@ fn usz? Formatter.floatformat(&self, FloatFormatting formatting, double y) @priv
|
||||
}
|
||||
|
||||
// Perform rounding: j is precision after the radix (possibly neg)
|
||||
int j = (int)(p - (isz)(formatting == FLOAT ? 0 : e - (int)(formatting == ADAPTIVE && p)));
|
||||
int j = (int)p;
|
||||
if (formatting != FLOAT) j -= e;
|
||||
if (formatting == ADAPTIVE && p != 0) j -= 1;
|
||||
|
||||
if (j < 9 * (z - r - 1))
|
||||
{
|
||||
uint x;
|
||||
|
||||
Reference in New Issue
Block a user