fix: correction erreur nombres petits...reste gestion des exposants
This commit is contained in:
parent
9b421fd7cc
commit
a3d718e69e
14
lib/video.c
14
lib/video.c
|
@ -550,7 +550,7 @@ u8 *rtoasingle(float num, u8 * str, u8 precision) {
|
||||||
{
|
{
|
||||||
*pointer = '.';
|
*pointer = '.';
|
||||||
fracpart = fracpart * pow(10, precision);
|
fracpart = fracpart * pow(10, precision);
|
||||||
sitoa((u32)fracpart, pointer+1, 0xFFFFFFFF);
|
itoa((u32)fracpart, pointer+1, 10 , precision, '0');
|
||||||
}
|
}
|
||||||
return pointer;
|
return pointer;
|
||||||
}
|
}
|
||||||
|
@ -562,8 +562,10 @@ u8 *itoa(u64 orignum, u8 * str, u8 base, u64 dim, u8 achar)
|
||||||
{
|
{
|
||||||
u8 *pointer = str, i, size = 0;
|
u8 *pointer = str, i, size = 0;
|
||||||
u64 num = orignum;
|
u64 num = orignum;
|
||||||
|
if (dim>=0xFF)
|
||||||
|
{
|
||||||
num &= dim;
|
num &= dim;
|
||||||
if (num == 0 && (achar == 0)) {
|
if ((num == 0) && (achar == 0)) {
|
||||||
*(pointer++) = '0';
|
*(pointer++) = '0';
|
||||||
*pointer = '\000';
|
*pointer = '\000';
|
||||||
return pointer;
|
return pointer;
|
||||||
|
@ -582,10 +584,16 @@ u8 *itoa(u64 orignum, u8 * str, u8 base, u64 dim, u8 achar)
|
||||||
size = log2(dim) / 4;
|
size = log2(dim) / 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
size=dim;
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
if (num == 0) {
|
if (num == 0) {
|
||||||
if (achar == 0) break;
|
if (i==0)
|
||||||
|
*(pointer++) = '0';
|
||||||
|
else
|
||||||
*(pointer++) = achar;
|
*(pointer++) = achar;
|
||||||
|
if (achar == 0) break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -109,7 +109,7 @@ int main(u32 magic, u32 addr)
|
||||||
|
|
||||||
float test=3.14f;
|
float test=3.14f;
|
||||||
double test2=3.14;
|
double test2=3.14;
|
||||||
printf(" -Test float & double %f %lf %f %f %f %f",test,test2,0.1212412544f,0.1f,15545487.0f,0.0001f);
|
printf(" -Test float & double %f %lf %f %f %f %f",test,test2,0.1212412544f,0.1f,15545485425425425425425425425427878787.0f,0.0001f);
|
||||||
retry:
|
retry:
|
||||||
shell();
|
shell();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue