提交 4d55ce59 编写于 作者: 杜庆泉's avatar 杜庆泉

修改number/global 部分数字判断条件

上级 8208625b
......@@ -32,9 +32,9 @@ export function testGlobal(): Result {
expect(isNaN(parseInt("345", 2))).toEqual(true)
expect(isNaN(parseInt("hello"))).toEqual(true)
expect(parseInt("6.022e23")).toEqual(6)
expect(parseInt("9223372036854775807")).toEqual(9.223372036854778e+18)
expect(parseInt("9223372036854775807000")).toEqual(9.223372036854777e+21)
expect(parseInt("922337203685477580700099999999999999999999999999999999999999999999999999999999999999999")).toEqual(9.223372036854776e+86)
expect(parseInt("9223372036854775807")).toEqualNumber(9.223372036854778e+18)
expect(parseInt("9223372036854775807000")).toEqualNumber(9.223372036854777e+21)
expect(parseInt("922337203685477580700099999999999999999999999999999999999999999999999999999999999999999")).toEqualNumber(9.223372036854776e+86)
expect(parseInt("50") / 100).toEqualNumber(0.5);
expect(parseInt("500") / 100).toEqualNumber(5);
......
......@@ -98,7 +98,13 @@ export function testNumber() : Result {
expect(a.toString(2).substring(0,32)).toEqual("10010110011101101001100101010000");
expect(a.toString(2).substring(100)).toEqual("000000000000000000000000000");
const b = 1e22
expect(b.toString(12)).toEqual("27373a86ba1a194a65054");
const bStr12 = b.toString(12)
/**
* 移动端: 27373a86ba1a194a65054
* 浏览器端:27373a86ba1a195400000
*/
expect(bStr12.length).toEqual(21);
expect(bStr12.substring(0,14)).toEqual("27373a86ba1a19");
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册