Diamond Control Suite 3.0

diamondedge.util
Class MoreMath

java.lang.Object
  extended by diamondedge.util.MoreMath

public class MoreMath
extends Object


Constructor Summary
MoreMath()
           
 
Method Summary
static double acosh(double x)
          Returns the inverse hyperbolic cosine of a number.
static double asinh(double x)
          Returns the inverse hyperbolic sine of a number.
static double atanh(double x)
          Returns the inverse hyperbolic tangent of a number.
static double ceil(double n, double sig)
          Returns number rounded up, away from zero, to the nearest multiple of significance.
static int combinations(int n, int groupSize)
          Returns the total possible number of groups for a given number of items.
static double cosh(double x)
          Returns the hyperbolic cosine of a number.
static double even(double n)
          Returns number rounded up to the nearest even integer.
static int factorial(int n)
          Returns the factorial of a number.
static double floor(double n, double sig)
          Rounds number down, toward zero, to the nearest multiple of significance.
static double log(double x, double base)
          Returns the logarithm of a number to the specified base.
static double log10(double x)
          Returns the base-10 logarithm of a number.
static int mod(int n, int divisor)
          Returns the remainder after number is divided by divisor.
static double odd(double n)
          Returns number rounded up to the nearest odd integer.
static int permutations(int n, int groupSize)
          Returns the total possible number of order dependent arrangements for a given number of items.
static int quotient(int n, int divisor)
          Returns the remainder after number is divided by divisor.
static int random(int n1, int n2)
          Returns a random number between the numbers you specify.
static double round(double n, double digits)
          Rounds a number to a specified number of digits.
static double roundDown(double n, double digits)
          Rounds a number down (toward zero).
static double roundUp(double n, double digits)
          Rounds a number up (away from zero).
static int sign(double n)
          Returns an integer indicating the sign of a number.
static double sinh(double x)
          Returns the hyperbolic sine of a number.
static double tanh(double x)
          Returns the hyperbolic tangent of a number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoreMath

public MoreMath()
Method Detail

log

public static double log(double x,
                         double base)
Returns the logarithm of a number to the specified base.


log10

public static double log10(double x)
Returns the base-10 logarithm of a number.


acosh

public static double acosh(double x)
Returns the inverse hyperbolic cosine of a number.


asinh

public static double asinh(double x)
Returns the inverse hyperbolic sine of a number.


atanh

public static double atanh(double x)
Returns the inverse hyperbolic tangent of a number.


cosh

public static double cosh(double x)
Returns the hyperbolic cosine of a number.


sinh

public static double sinh(double x)
Returns the hyperbolic sine of a number.


tanh

public static double tanh(double x)
Returns the hyperbolic tangent of a number.


factorial

public static int factorial(int n)
Returns the factorial of a number.


permutations

public static int permutations(int n,
                               int groupSize)
Returns the total possible number of order dependent arrangements for a given number of items.

Parameters:
n - total number of items
groupSize - number of items in each group example p(4,3) = 24

combinations

public static int combinations(int n,
                               int groupSize)
Returns the total possible number of groups for a given number of items.

Parameters:
n - total number of items
groupSize - number of items in each group example c(6,4) = 15

mod

public static int mod(int n,
                      int divisor)
Returns the remainder after number is divided by divisor. The result has the same sign as divisor.


quotient

public static int quotient(int n,
                           int divisor)
Returns the remainder after number is divided by divisor. The result has the same sign as divisor.


random

public static int random(int n1,
                         int n2)
Returns a random number between the numbers you specify.

Parameters:
n1 - smallest integer random will return
n2 - largest integer random will return

ceil

public static double ceil(double n,
                          double sig)
Returns number rounded up, away from zero, to the nearest multiple of significance. For example, if you want to avoid using pennies in your prices and your product is priced at $4.42, use the formula =CEILING(4.42,0.05) to round prices up to the nearest nickel.

Parameters:
n - is the number you want to round.
sig - is the multiple to which you want to round.

floor

public static double floor(double n,
                           double sig)
Rounds number down, toward zero, to the nearest multiple of significance.

Parameters:
n - is the number you want to round.
sig - is the multiple to which you want to round.

round

public static double round(double n,
                           double digits)
Rounds a number to a specified number of digits. If two values are equally close, the number is rounded away from zero.

Parameters:
n - is the number you want to round.
digits - specifies the number of digits to which you want to round number.
  • If 0, then the number is rounded to the closest integer.
  • If > 0, then the number is rounded to the given decimal place.
  • If < 0, then the number is rounded to the given place left of the decimal.

roundUp

public static double roundUp(double n,
                             double digits)
Rounds a number up (away from zero).

Parameters:
n - is the number you want to round.
digits - specifies the number of digits to which you want to round number.
  • If 0, then the number is rounded to the closest integer.
  • If > 0, then the number is rounded to the given decimal place.
  • If < 0, then the number is rounded to the given place left of the decimal.

roundDown

public static double roundDown(double n,
                               double digits)
Rounds a number down (toward zero).

Parameters:
n - is the number you want to round.
digits - specifies the number of digits to which you want to round number.
  • If 0, then the number is rounded to the closest integer.
  • If > 0, then the number is rounded to the given decimal place.
  • If < 0, then the number is rounded to the given place left of the decimal.

odd

public static double odd(double n)
Returns number rounded up to the nearest odd integer.

Parameters:
n - is the number you want to round.

even

public static double even(double n)
Returns number rounded up to the nearest even integer.

Parameters:
n - is the number you want to round.

sign

public static int sign(double n)
Returns an integer indicating the sign of a number. Returns 1 if the number is positive, zero (0) if the number is 0, and -1 if the number is negative.


Diamond Control Suite 3.0

Diamond Edge and Diamond Control Suite are trademarks or registered trademarks of Diamond Edge, Inc. Copyright 1999-2005 Diamond Edge, Inc. All Rights Reserved.