Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.dinopolis.gpstool.util.angle
Class XMath  view XMath download XMath.java

java.lang.Object
  extended byorg.dinopolis.gpstool.util.angle.XMath

public final class XMath
extends java.lang.Object

Simple mathematical functions. Some of these functions will be removed if JavaSoft provide a standard implementation or fix some issues in Bug Parade:

Version:
$Id: XMath.java,v 1.1.1.1 2003/01/10 15:33:37 cdaller Exp $

Field Summary
static double LN10
          Natural logarithm of 10.
private static double[] POW10
          Table of some integer powers of 10.
 
Constructor Summary
private XMath()
          Do not allow instantiation of this class.
 
Method Summary
static double cbrt(double x)
          Combute the cubic root of the specified value.
static double hypot(double x, double y)
          Compute the hypotenuse (sqrt(x²+y²)).
static double log10(double x)
          Compute the logarithm in base 10.
static double next(double f)
          Finds the least double greater than f.
static float next(float f)
          Finds the least float greater than f.
private static float next(float f, boolean positive)
          Finds the least float greater than d (if positive == true), or the greatest float less than d (if positive == false).
static double pow10(double x)
          Compute 10 power x.
static double pow10(int x)
          Compute x to the power of 10.
static double previous(double f)
          Finds the greatest double less than f.
static float previous(float f)
          Finds the greatest float less than f.
static byte sgn(byte x)
          Returns the sign of x.
static int sgn(double x)
          Returns the sign of x.
static int sgn(float x)
          Returns the sign of x.
static int sgn(int x)
          Returns the sign of x.
static int sgn(long x)
          Returns the sign of x.
static short sgn(short x)
          Returns the sign of x.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LN10

public static final double LN10
Natural logarithm of 10. Approximately equal to 2.302585.

See Also:
Constant Field Values

POW10

private static final double[] POW10
Table of some integer powers of 10. Used for fast computation of pow10(int) 55 .

Constructor Detail

XMath

private XMath()
Do not allow instantiation of this class.

Method Detail

cbrt

public static double cbrt(double x)
Combute the cubic root of the specified value. This is method will be removed if RFE 4633024 is implemented.


hypot

public static double hypot(double x,
                           double y)
Compute the hypotenuse (sqrt(x²+y²)).


log10

public static double log10(double x)
Compute the logarithm in base 10. See http://developer.java.sun.com/developer/bugParade/bugs/4074599.html.


pow10

public static double pow10(double x)
Compute 10 power x.


pow10

public static double pow10(int x)
Compute x to the power of 10. This computation is very fast for small power of 10 but has some rounding error issues (see http://developer.java.sun.com/developer/bugParade/bugs/4358794.html).


sgn

public static int sgn(double x)
Returns the sign of x. This method returns -1 if x is negative, 0 if x is null or NaN and +1 if x is positive.


sgn

public static int sgn(float x)
Returns the sign of x. This method returns -1 if x is negative, 0 if x is null or NaN and +1 if x is positive.


sgn

public static int sgn(long x)
Returns the sign of x. This method returns -1 if x is negative, 0 if x is null and +1 if x is positive.


sgn

public static int sgn(int x)
Returns the sign of x. This method returns -1 if x is negative, 0 if x is null and +1 if x is positive.


sgn

public static short sgn(short x)
Returns the sign of x. This method returns -1 if x is negative, 0 if x is null and +1 if x is positive.


sgn

public static byte sgn(byte x)
Returns the sign of x. This method returns -1 if x is negative, 0 if x is null and +1 if x is positive.


next

private static float next(float f,
                          boolean positive)
Finds the least float greater than d (if positive == true), or the greatest float less than d (if positive == false). If NaN, returns same value. This code is an adaptation of ChoiceFormat.nextDouble(double)>ChoiceFormat.nextDouble(double) 55 .


next

public static float next(float f)
Finds the least float greater than f. If NaN, returns same value.


previous

public static float previous(float f)
Finds the greatest float less than f. If NaN, returns same value.


next

public static double next(double f)
Finds the least double greater than f. If NaN, returns same value.


previous

public static double previous(double f)
Finds the greatest double less than f. If NaN, returns same value.