js parseFloat 精度问题

<script type="text/javascript">

//parseFloat

function actionoftext(){
var price = 10.99;
var quantity = 7;

var a="18.11";
var b="36.23"
//54.339999999999996

var t=0;
var needPay = parseFloat(a);
needPay = needPay+parseFloat(b);
alert("test"+needPay);
document.write("test "+needPay);
}



</script>

posted on 2017-05-25 13:43  rojas  阅读(263)  评论(0编辑  收藏  举报