Terrier IR Platform
2.2.1

uk.ac.gla.terrier.utility
Class Rounding

java.lang.Object
  extended by uk.ac.gla.terrier.utility.Rounding

public class Rounding
extends java.lang.Object

A class for performing the rounding of a number in various ways for various applications.

Version:
$Revision: 1.16 $
Author:
Gianni Amati, Ben He, Vassilis Plachouras, Craig Macdonald

Constructor Summary
Rounding()
           
 
Method Summary
static double round(double val, int places)
          Round a double alue to a specified number of decimal places.
static float round(float val, int places)
          Round a float value to a specified number of decimal places.
static java.lang.String toString(double d, int place)
          Rounds to place digits and transforms the double number d to a string for printing
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rounding

public Rounding()
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 transform
place - 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

Terrier IR Platform
2.2.1

Terrier Information Retrieval Platform 2.2.1. Copyright 2004-2008 University of Glasgow