日期:2014-05-16  浏览次数:20616 次

js浮点丢失问题
  1. //加法???
  2. Number.prototype.add?=?function(arg){ ??
  3. ????var?r1,r2,m; ??
  4. ????try{r1=this.toString().split(".")[1].length}catch(e){r1=0} ??
  5. ????try{r2=arg.toString().split(".")[1].length}catch(e){r2=0} ??
  6. ????m=Math.pow(10,Math.max(r1,r2)) ??
  7. ????return?(this*m+arg*m)/m ??
  8. } ??
友情链接: 爱易网 云虚拟主机技术 云服务器技术 程序设计技术 开发网站 APP开发教程
Copyright © 2013-2026 爱易网页 当前在线:1246人  网站在20时55分28秒内访问总人数:249796人 2秒前 48.86%  粤ICP备18100884号-2