Improve float number handling and conversion (#4820)

Fixes #4739.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
Dániel Bátyai
2021-12-03 12:58:37 +01:00
committed by GitHub
parent a1c1d42710
commit 81d2319144
30 changed files with 1022 additions and 1603 deletions
+3 -3
View File
@@ -42,8 +42,8 @@ assert((-0.03125).toString(2) === "-0.00001");
assert((-0.03125).toString(16) === "-0.08");
assert((-0.0001).toString(4) === "-0.000000122031232023223013010030231")
assert((-0).toString(16) === "0");
assert((1e+73).toString(35) === "2nx1mg1l0w4ujlpt449c5qfrkkmtpgpsfsc2prlaqtnjbli2")
assert((-1e+73).toString(35) === "-2nx1mg1l0w4ujlpt449c5qfrkkmtpgpsfsc2prlaqtnjbli2")
assert((1e+73).toString(35) === "2nx1mg1l0w6b000000000000000000000000000000000000")
assert((-1e+73).toString(35) === "-2nx1mg1l0w6b000000000000000000000000000000000000")
assert((1).toString(undefined) === "1")
assert((123400).toString(2) === "11110001000001000");
@@ -90,7 +90,7 @@ assert ((-0x100000000000061).toString(16) === "-100000000000060");
assert((123400).toString(new Number(16)) === "1e208");
assert(65535.9.toString(3) === "10022220020.2200220022002200220022102110122000001102212");
assert(65535.9.toString(3) === "10022220020.220022002200220022002201");
var digit_chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
+1 -1
View File
@@ -1175,7 +1175,7 @@
(function tc_15_07_04_02__001() {
var a = Number(0.1);
assert(a.toString(36) === "0.3llllllllllqsn8td1p464unmi");
assert(a.toString(36) === "0.3lllllllllm");
})();
(function tc_15_07_04_02__013() {
+1
View File
@@ -20,6 +20,7 @@
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
#include "ecma-globals.h"
#include "ecma-helpers-number.h"
#include "ecma-helpers.h"
#include "ecma-init-finalize.h"