js 16位丢失精度

2021-03-29 07:25

阅读:499

YPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

标签:public   order   javascrip   mono   weight   osi   attach   http   ubuntu   

 new document 

  

html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
html xmlns="http://www.w3.org/1999/xhtml">
 head>
  title> new document title>
  meta name="generator" content="editplus" />
  meta name="author" content="" />
  meta name="keywords" content="" />
  meta name="description" content="" />
 head>
 
 body>
 
script language="javascript" type="text/javascript">
var numStr = "";
var charNine = "9";
var maxLength = 20;
for (var i=1; i
{
    numStr += charNine;
    document.write(i, ": Str: ", numStr, " Num: ",parseInt(numStr), "br />");
}
 
/*
1: Str: 9 Num: 9
2: Str: 99 Num: 99
3: Str: 999 Num: 999
4: Str: 9999 Num: 9999
5: Str: 99999 Num: 99999
6: Str: 999999 Num: 999999
7: Str: 9999999 Num: 9999999
8: Str: 99999999 Num: 99999999
9: Str: 999999999 Num: 999999999
10: Str: 9999999999 Num: 9999999999
11: Str: 99999999999 Num: 99999999999
12: Str: 999999999999 Num: 999999999999
13: Str: 9999999999999 Num: 9999999999999
14: Str: 99999999999999 Num: 99999999999999
15: Str: 999999999999999 Num: 999999999999999
16: Str: 9999999999999999 Num: 10000000000000000
17: Str: 99999999999999999 Num: 100000000000000000
18: Str: 999999999999999999 Num: 1000000000000000000
19: Str: 9999999999999999999 Num: 10000000000000000000
20: Str: 99999999999999999999 Num: 100000000000000000000
*/
script>
 
 body>
html>

js 16位丢失精度

标签:public   order   javascrip   mono   weight   osi   attach   http   ubuntu   

原文地址:https://www.cnblogs.com/nb123/p/12608974.html


评论


亲,登录后才可以留言!