joeq.Support
Class JMath

java.lang.Object
  extended by joeq.Support.JMath

public final class JMath
extends Object


Field Summary
static double E
           
static double PI
           
 
Constructor Summary
JMath()
           
 
Method Summary
static double abs(double x)
          Returns the absolute value of its argument.
static float abs(float x)
          Returns the absolute value of its argument.
static int abs(int x)
          Returns the absolute value of its argument.
static long abs(long x)
          Returns the absolute value of its argument.
static double acos(double x)
          Returns the inverse (arc) cosine of its argument.
static double asin(double x)
          Returns the inverse (arc) sine of its argument.
static double atan(double x)
          Returns the inverse (arc) tangent of its argument.
static double atan2(double y, double x)
          Returns angle corresponding to a Cartesian point.
static double ceil(double x)
          Returns the value of its argument rounded toward positive infinity to an integral value.
static double cos(double x)
          Returns the cosine of its argument.
static double exp(double x)
          Returns the exponential of its argument.
static double floor(double x)
          Returns the value of its argument rounded toward negative infinity to an integral value.
static double IEEEremainder(double x, double p)
          Returns x REM p = x - [x/p]*p as if in infinite precise arithmetic, where [x/p] is the (infinite bit) integer nearest x/p (in half way case choose the even one).
static double log(double x)
          Returns the natural logarithm of its argument.
static double max(double x, double y)
          Returns the larger of its two arguments.
static float max(float x, float y)
          Returns the larger of its two arguments.
static int max(int x, int y)
          Returns the larger of its two arguments.
static long max(long x, long y)
          Returns the larger of its two arguments.
static double min(double x, double y)
          Returns the smaller of its two arguments.
static float min(float x, float y)
          Returns the smaller of its two arguments.
static int min(int x, int y)
          Returns the smaller of its two arguments.
static long min(long x, long y)
          Returns the smaller of its two arguments.
static double pow(double x, double y)
          Returns x to the power y.
static double random()
          Returns the random number.
static double rint(double x)
          Returns the value of its argument rounded toward the closest integral value.
static long round(double x)
          Returns the long closest to the arguments.
static int round(float x)
          Returns the integer closest to the arguments.
static double sin(double x)
          Returns the sine of its argument.
static double sqrt(double x)
          Returns the square root of its argument.
static double tan(double x)
          Returns the tangent of its argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PI

public static final double PI

E

public static final double E
See Also:
Constant Field Values
Constructor Detail

JMath

public JMath()
Method Detail

abs

public static int abs(int x)
Returns the absolute value of its argument.

Parameters:
x - The argument, an integer.
Returns:
Returns |x|.

abs

public static long abs(long x)
Returns the absolute value of its argument.

Parameters:
x - The argument, a long.
Returns:
Returns |x|.

abs

public static float abs(float x)
Returns the absolute value of its argument.

Parameters:
x - The argument, a float.
Returns:
Returns |x|.

abs

public static double abs(double x)
Returns the absolute value of its argument.

Parameters:
x - The argument, a double.
Returns:
Returns |x|.

min

public static int min(int x,
                      int y)
Returns the smaller of its two arguments.

Parameters:
x - The first argument, an integer.
y - The second argument, an integer.
Returns:
Returns the smaller of x and y.

min

public static long min(long x,
                       long y)
Returns the smaller of its two arguments.

Parameters:
x - The first argument, a long.
y - The second argument, a long.
Returns:
Returns the smaller of x and y.

min

public static float min(float x,
                        float y)
Returns the smaller of its two arguments.

Parameters:
x - The first argument, a float.
y - The second argument, a float.
Returns:
Returns the smaller of x and y. This function considers -0.0f to be less than 0.0f.

min

public static double min(double x,
                         double y)
Returns the smaller of its two arguments.

Parameters:
x - The first argument, a double.
y - The second argument, a double.
Returns:
Returns the smaller of x and y. This function considers -0.0 to be less than 0.0.

max

public static int max(int x,
                      int y)
Returns the larger of its two arguments.

Parameters:
x - The first argument, an integer.
y - The second argument, an integer.
Returns:
Returns the larger of x and y.

max

public static long max(long x,
                       long y)
Returns the larger of its two arguments.

Parameters:
x - The first argument, a long.
y - The second argument, a long.
Returns:
Returns the larger of x and y.

max

public static float max(float x,
                        float y)
Returns the larger of its two arguments.

Parameters:
x - The first argument, a float.
y - The second argument, a float.
Returns:
Returns the larger of x and y. This function considers -0.0f to be less than 0.0f.

max

public static double max(double x,
                         double y)
Returns the larger of its two arguments.

Parameters:
x - The first argument, a double.
y - The second argument, a double.
Returns:
Returns the larger of x and y. This function considers -0.0 to be less than 0.0.

round

public static int round(float x)
Returns the integer closest to the arguments.

Parameters:
x - The argument, a float.
Returns:
Returns the integer closest to x.

round

public static long round(double x)
Returns the long closest to the arguments.

Parameters:
x - The argument, a double.
Returns:
Returns the long closest to x.

random

public static double random()
Returns the random number.

Returns:
Returns a random number from a uniform distribution.

ceil

public static double ceil(double x)
Returns the value of its argument rounded toward positive infinity to an integral value.

Parameters:
x - The argument, a double.
Returns:
Returns the smallest double, not less than x, that is an integral value.

floor

public static double floor(double x)
Returns the value of its argument rounded toward negative infinity to an integral value.

Parameters:
x - The argument, a double.
Returns:
Returns the smallest double, not greater than x, that is an integral value.

rint

public static double rint(double x)
Returns the value of its argument rounded toward the closest integral value.

Parameters:
x - The argument, a double.
Returns:
Returns the double closest to x that is an integral value.

IEEEremainder

public static double IEEEremainder(double x,
                                   double p)
Returns x REM p = x - [x/p]*p as if in infinite precise arithmetic, where [x/p] is the (infinite bit) integer nearest x/p (in half way case choose the even one).

Parameters:
x - The dividend.
p - The divisor.
Returns:
The remainder computed according to the IEEE 754 standard.

sqrt

public static double sqrt(double x)
Returns the square root of its argument.

Parameters:
x - The argument, a double.
Returns:
Returns the square root of x.

exp

public static double exp(double x)
Returns the exponential of its argument.

Parameters:
x - The argument, a double.
Returns:
Returns e to the power x.

log

public static double log(double x)
Returns the natural logarithm of its argument.

Parameters:
x - The argument, a double.
Returns:
Returns the natural (base e) logarithm of x.

sin

public static double sin(double x)
Returns the sine of its argument.

Parameters:
x - The argument, a double, assumed to be in radians.
Returns:
Returns the sine of x.

cos

public static double cos(double x)
Returns the cosine of its argument.

Parameters:
x - The argument, a double, assumed to be in radians.
Returns:
Returns the cosine of x.

tan

public static double tan(double x)
Returns the tangent of its argument.

Parameters:
x - The argument, a double, assumed to be in radians.
Returns:
Returns the tangent of x.

asin

public static double asin(double x)
Returns the inverse (arc) sine of its argument.

Parameters:
x - The argument, a double.
Returns:
Returns the angle, in radians, whose sine is x. It is in the range [-pi/2,pi/2].

acos

public static double acos(double x)
Returns the inverse (arc) cosine of its argument.

Parameters:
x - The argument, a double.
Returns:
Returns the angle, in radians, whose cosine is x. It is in the range [0,pi].

atan

public static double atan(double x)
Returns the inverse (arc) tangent of its argument.

Parameters:
x - The argument, a double.
Returns:
Returns the angle, in radians, whose tangent is x. It is in the range [-pi/2,pi/2].

atan2

public static double atan2(double y,
                           double x)
Returns angle corresponding to a Cartesian point.

Parameters:
x - The first argument, a double.
y - The second argument, a double.
Returns:
Returns the angle, in radians, the the line from (0,0) to (x,y) makes with the x-axis. It is in the range [-pi,pi].

pow

public static double pow(double x,
                         double y)
Returns x to the power y.

Parameters:
x - The base.
y - The exponent.
Returns:
x to the power y.


Copyright © 2001-2008 John Whaley. All Rights Reserved.