Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript decimals without rounding

function getFlooredFixed(v, d) {
    return (Math.floor(v * Math.pow(10, d)) / Math.pow(10, d)).toFixed(d);
}

var x = 2.305185185185195;

document.write(getFlooredFixed(x, 5));
Source by coderedirect.com #
 
PREVIOUS NEXT
Tagged: #javascript #decimals #rounding
ADD COMMENT
Topic
Name
9+4 =