1. Clear the decimal point to zero:
function returnFloat0 (value) {
value = Math.round(parseFloat(value));
return value;
}
2. Keep one decimal point:
function returnFloat1(value) {
value = Math.round(parseFloat( value) * 10) / 10;
if (value.toString().indexOf(".") < 0) {
value = value.toString() ".0";
}
Return value;
}
3. Keep two decimal points
function returnFloat2(value){
value = Math.round(parseFloat(value) * 100) / 100;
if (value.toString().indexOf( ".") < 0) {
Two decimal points and one decimal point are automatically filled with zeros
Copy code
value = value.toString() ".00";
return value;
}
if(xsd .length>1){
🎜>}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn