mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-06 05:44:11 +08:00
修复浮点数为xxx.999这种输入的字符串转换问题
This commit is contained in:
parent
c8a1d11408
commit
a30575b935
@ -128,7 +128,12 @@ static char* float2str( float f, char out[16] )
|
||||
f *= 100;
|
||||
int n = floor(f);
|
||||
f = f - n;
|
||||
if( f > 0.5 ) ++n;
|
||||
if( f > 0.5) ++n;
|
||||
if( n == 100 )
|
||||
{
|
||||
++s;
|
||||
n = 0;
|
||||
}
|
||||
ee_snprintf(out, 16, "%d.%02d", s, n);
|
||||
return out;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user