soulpower 3 Posted January 23, 2011 Report Share Posted January 23, 2011 I'm doing keyword density reports for an article service that i'm running. I'm having trouble figuring out how to round a decimal to the 10th decimal place. So i want "flowers" - 0.40845070422535% to be 0.4% I tried using the Math.round function but I don't want it to round the numbers up or down, because it would show "0" for a value of 0.4 and I can't have that. I just want to cut off the number at the 10th decimal place. Any help is greatly appreciated, been at this for 4 hours now! lol Quote Link to post Share on other sites
soulpower 3 Posted January 23, 2011 Author Report Share Posted January 23, 2011 Ok, i figured out my problem in case it can help anyone. I used this function number.toFixed(1) Where "number" is the number you want to trim and the "1" means it chops off the number 1 position to the right of the decimal point. So the number I wanted to trim was "0.73389" I would use this... 0.73389.toFixed(1) which would give 0.7 1 Quote Link to post Share on other sites
JohnB 255 Posted January 23, 2011 Report Share Posted January 23, 2011 Nice find and share! +1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.