Package org.terrier.utility
Class Rounding
- java.lang.Object
 - 
- org.terrier.utility.Rounding
 
 
- 
public class Rounding extends java.lang.ObjectA class for performing the rounding of a number in various ways for various applications.- Author:
 - Gianni Amati, Ben He, Vassilis Plachouras, Craig Macdonald
 
 
- 
- 
Constructor Summary
Constructors Constructor Description Rounding() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doubleround(double val, int places)Round a double alue to a specified number of decimal places.static floatround(float val, int places)Round a float value to a specified number of decimal places.static java.lang.StringtoString(double d, int place)Rounds to place digits and transforms the double number d to a string for printing 
 - 
 
- 
- 
Method Detail
- 
toString
public static java.lang.String toString(double d, int place)Rounds to place digits and transforms the double number d to a string for printing- Parameters:
 d- double the number to transformplace- int the number of decimal digits- Returns:
 - String the string representing the rounded number.
 
 
- 
round
public static double round(double val, int places)Round a double alue to a specified number of decimal places.- Parameters:
 val- the value to be rounded.places- the number of decimal places to round to.- Returns:
 - val rounded to places decimal places.
 - Since:
 - 1.1.0
 
 
- 
round
public static float round(float val, int places)Round a float value to a specified number of decimal places. Calls round(double,int) internally.- Parameters:
 val- the value to be rounded.places- the number of decimal places to round to.- Returns:
 - val rounded to places decimal places.
 - Since:
 - 1.1.0
 
 
 - 
 
 -