首页 > 代码库 > js parseFloat 精度问题

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>

js parseFloat 精度问题