com.partnersoft.data
Class MathLib

java.lang.Object
  extended by com.partnersoft.data.MathLib
All Implemented Interfaces:
Lib

public class MathLib
extends java.lang.Object
implements Lib

Math and number functions.

Copyright 2006 Partner Software, Inc.

Version:
$Id: MathLib.java 1012 2007-11-24 18:30:02Z paul $
Author:
Paul Reavis, Russell Cagle

Method Summary
static long combinations(int n, int m)
          Returns the number of combinations of n things, taken m at a time.
static long factorial(int n)
          Returns the factorial of the given input (n!).
static double setPrecision(double victim, int places)
          Reduces the precision of a double-precision number by rounding it to a specified number of decimal places.
static float setPrecision(float victim, int places)
          Reduces the precision of a floating-point number by rounding it to a specified number of decimal places.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setPrecision

public static double setPrecision(double victim,
                                  int places)
Reduces the precision of a double-precision number by rounding it to a specified number of decimal places.


setPrecision

public static float setPrecision(float victim,
                                 int places)
Reduces the precision of a floating-point number by rounding it to a specified number of decimal places.


factorial

public static long factorial(int n)
Returns the factorial of the given input (n!).

Parameters:
n -
Returns:
n!

combinations

public static long combinations(int n,
                                int m)
Returns the number of combinations of n things, taken m at a time.

Parameters:
n -
m -
Returns:
n! / (m! * (n-m)!)