Improving precision of number to zt-string conversion, adding search for the shortest representation of number during the conversion.

This commit is contained in:
Ruben Ayrapetyan
2014-10-24 19:15:31 +04:00
parent 4f68e43b7d
commit e4629cca51
5 changed files with 326 additions and 161 deletions
+10 -10
View File
@@ -32,8 +32,8 @@ main( int __unused argc,
(const ecma_char_t*) "1",
(const ecma_char_t*) "0.5",
(const ecma_char_t*) "12345",
(const ecma_char_t*) "12345.12209",
(const ecma_char_t*) "1.401298403e-45",
(const ecma_char_t*) "12345.123",
(const ecma_char_t*) "1e-45",
(const ecma_char_t*) "-2.5e+38",
(const ecma_char_t*) "NaN",
(const ecma_char_t*) "Infinity",
@@ -44,17 +44,17 @@ main( int __unused argc,
const ecma_number_t nums[] =
{
1.0f,
0.5f,
12345.0f,
12345.123f,
1.0e-45f,
-2.5e+38f,
1.0,
0.5,
12345.0,
12345.123,
1.0e-45,
-2.5e+38,
NAN,
INFINITY,
-INFINITY,
+0.0f,
-0.0f
+0.0,
-0.0
};
for (uint32_t i = 0;
+8 -8
View File
@@ -51,12 +51,12 @@ main( int __unused argc,
const ecma_number_t nums[] =
{
1.0f,
0.5f,
12345.0f,
1.0e-45f,
-2.5e+38f,
-2.5e+38f,
1.0,
0.5,
12345.0,
1.0e-45,
-2.5e+38,
-2.5e+38,
NAN,
NAN,
NAN,
@@ -67,8 +67,8 @@ main( int __unused argc,
NAN,
INFINITY,
-INFINITY,
+0.0f,
-0.0f
+0.0,
-0.0
};
for (uint32_t i = 0;