Javascript实现求小数点后100位数值
作者:互联网
function num(a,b){
let list=[]
let n1=a%b; //求余
while(list.length<100){ //100位
let n2 =Math.floor(n1*10/b)
list.push(n2)
n1=n1*10%b //继续求余
}
return list.join('')
}
num(40,13)
//"0769230769230769230769230769230769230769230769230769230769230769230769230769230769230769230769230769"
标签:Javascript,list,小数点,n2,num,let,n1,100,求余 来源: https://www.cnblogs.com/coolFQ/p/11772183.html