解题思路:
(1)首先判断最长的小数位数
(2)然后设置返回精度
function multiply(a, b) {
var x,y;
try {
x = a.toString().split(".")[1].length;
}catch(e){
x = 0;
};
try{
y = b.toString().split(".")[1].length;
}catch(e){
y = 0;
};
var fixed = Math.max(x,y);
return (a*b).toFixed(fixed);
}