Advertisement
Guest User

Function to truncate too much decimals

a guest
Jul 20th, 2013
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.16 KB | None | 0 0
  1. static public double truncateDecimals(double n, int numberOfDecimals){
  2.        return Math.floor(n*Math.pow(10,numberOfDecimals))/Math.pow(10, numberOfDecimals);
  3. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement