function returnFloat_thousand(value){
var value=Math.ceil(Math.round(parseFloat(value)*100)/100)/10000;
var xsd=value.toString().split(".");
console.log(xsd);
if(xsd.length==1){
value=value.toString();
value=value.toString()+".00";
return value.toFixed(2);
}
if(xsd.length>1){
if(xsd[1].length<2){
value=value.toString();
value=value.toString()+"0";
}
return value.toFixed(2);
}
}
console.log(returnFloat_thousand(1111456)); //结果 :111.15
returnFloat_thousand() 以万计数 ,如100,结果是0.01
原创wx5b24b124aba12 ©著作权
©著作权归作者所有:来自51CTO博客作者wx5b24b124aba12的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:qrcode.js扫码邀请
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
C# Onnx yolov8 竹签计数、一次性筷子计数
C# Onnx yolov8 竹签计数、一次性筷子计数
Image System Text -
为什么123 and 456结果是456而123 or 456结果是123?
转载:方便自己找。原文链接在下面。 自己加了点总结哈哈!and:空格不要忘记了!对于and,首先计算第一个表达式,若为真,则计算第二个表达式,若为真,则返回第二个真值。 如:123 and 456 返回456 若为假,则返回该假值。 如:123 and 0 返回0
运算符 and和or 为什么123 and 456结果是456 而123 or 456结果是123? javascript -
良心老板奖励100万,结果...
耐人寻味
程序员 生活 漫画 -
下面代码的输出结果是()
int main(){ int pid; int num=1; pid=fork(); if(pid>0){ num++; printf("in parent:nu
1024程序员节 父子进程 虚拟地址 物理地址