org.deegree_impl.model.resources
Class XMath

java.lang.Object
  extended byorg.deegree_impl.model.resources.XMath

public final class XMath
extends java.lang.Object

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

Version:
1.0
Author:
Martin Desruisseaux

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 hypot(double x, double y)
          Compute the hypothenuse (sqrt(x²+y²)).
static double log10(double x)
          Compute the logarithm in base 10.
static double pow10(double x)
          Compute 10 power x.
static double pow10(int x)
          Compute 10 power x.
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. Approximatively equals 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).

Constructor Detail

XMath

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

Method Detail

hypot

public static double hypot(double x,
                           double y)
Compute the hypothenuse (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 10 power x. This computation is very fast for small power of 10 and avoir some rounding error issue (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.