## com.bbn.openmap
Class MoreMath

    java.lang.Object
      com.bbn.openmap.MoreMath

public class MoreMath
extends java.lang.Object

MoreMath provides functions that are not part of the standard Math class.

      Functions:
           asinh(float x) - hyperbolic arcsine
           sinh(float x) - hyperbolic sine

      Need to Implement:
      Function                Definition
      Hyperbolic cosine       (eˆx+eˆ-x)/2
      Hyperbolic tangent      (eˆx-eˆ-x)/(eˆx+eˆ-x)
      Hyperbolic arc cosine   2 log  (sqrt((x+1)/2) + sqrt((x-1)/2))
      Hyperbolic arc tangent  (log  (1+x) - log (1-x))/2

Field Summary
`static float` `HALF_PI` Math.PI/2
`static double` `HALF_PI_D` Math.PI/2
`static float` `TWO_PI` 2*Math.PI
`static double` `TWO_PI_D` 2*Math.PI

Method Summary
`static boolean` `approximately_equal(double a, double b, double epsilon)` Checks if a ~= b.
`static boolean` `approximately_equal(float a, float b, float epsilon)` Checks if a ~= b.
`static double` `asinh(double x)` Hyperbolic arcsin.
`static float` `asinh(float x)` Hyperbolic arcsin.
`static int` `BuildInteger(byte[] bytevec, boolean MSBFirst)` Build int out of bytes.
`static int` `BuildInteger(byte[] bytevec, int offset, boolean MSBFirst)` Build int out of bytes.
`static int` `BuildIntegerBE(byte[] bytevec)` Build int out of bytes (in big endian order).
`static int` `BuildIntegerBE(byte[] bytevec, int offset)` Build int out of bytes (in big endian order).
`static int` `BuildIntegerLE(byte[] bytevec)` Build int out of bytes (in little endian order).
`static int` `BuildIntegerLE(byte[] bytevec, int offset)` Build int out of bytes (in little endian order).
`static long` `BuildLong(byte[] bytevec, boolean MSBFirst)` Build long out of bytes.
`static long` `BuildLong(byte[] bytevec, int offset, boolean MSBFirst)` Build long out of bytes.
`static long` `BuildLongBE(byte[] bytevec)` Build long out of bytes (in big endian order).
`static long` `BuildLongBE(byte[] bytevec, int offset)` Build long out of bytes (in big endian order).
`static long` `BuildLongLE(byte[] bytevec)` Build long out of bytes (in little endian order).
`static long` `BuildLongLE(byte[] bytevec, int offset)` Build long out of bytes (in little endian order).
`static short` `BuildShort(byte[] bytevec, boolean MSBFirst)` Build short out of bytes.
`static short` `BuildShort(byte[] bytevec, int offset, boolean MSBFirst)` Build short out of bytes.
`static short` `BuildShortBE(byte[] bytevec, boolean MSBFirst)` Build short out of bytes (in big endian order).
`static short` `BuildShortBE(byte[] bytevec, int offset)` Build short out of bytes (in big endian order).
`static short` `BuildShortLE(byte[] bytevec, boolean MSBFirst)` Build short out of bytes (in little endian order).
`static short` `BuildShortLE(byte[] bytevec, int offset)` Build short out of bytes (in little endian order).
`static boolean` `even(int x)` Check if number is even.
`static boolean` `even(long x)` Check if number is even.
`static boolean` `even(short x)` Check if number is even.
`static boolean` `odd(int x)` Check if number is odd.
`static boolean` `odd(long x)` Check if number is odd.
`static boolean` `odd(short x)` Check if number is odd.
`static int` `sign(double x)` Return sign of number.
`static int` `sign(float x)` Return sign of number.
`static int` `sign(int x)` Return sign of number.
`static int` `sign(long x)` Return sign of number.
`static int` `sign(short x)` Return sign of number.
`static int` `signedToInt(byte b)` Converts a byte in the range of -128 to 127 to an int in the range 0 - 255.
`static int` `signedToInt(short w)` Converts a short in the range of -32768 to 32767 to an int in the range 0 - 65535.
`static long` `signedToLong(int x)` Convert an int in the range of -2147483648 to 2147483647 to a long in the range 0 to 4294967295.
`static double` `sinh(double x)` Hyperbolic sin.
`static float` `sinh(float x)` Hyperbolic sin.
`static int` `wordToByte(int w)` Converts an int in the range of 0 - 65535 to an int in the range of 0 - 255.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TWO_PI

    public static final transient float TWO_PI

  2*Math.PI

  See Also:
    Constant Field Values

### TWO_PI_D

    public static final transient double TWO_PI_D

  2*Math.PI

  See Also:
    Constant Field Values

### HALF_PI

    public static final transient float HALF_PI

  Math.PI/2

  See Also:
    Constant Field Values

### HALF_PI_D

    public static final transient double HALF_PI_D

  Math.PI/2

  See Also:
    Constant Field Values

Method Detail

### approximately_equal

    public static final boolean approximately_equal(double a,
                                                    double b,
                                                    double epsilon)

  Checks if a ~= b. Use this to test equality of floating point numbers.

  Parameters:
    `a` - double
    `b` - double
    `epsilon` - the allowable error
  Returns:
    boolean

### approximately_equal

    public static final boolean approximately_equal(float a,
                                                    float b,
                                                    float epsilon)

  Checks if a ~= b. Use this to test equality of floating point numbers.

  Parameters:
    `a` - float
    `b` - float
    `epsilon` - the allowable error
  Returns:
    boolean

### asinh

    public static final float asinh(float x)

  Hyperbolic arcsin.

  Hyperbolic arc sine: log (x+sqrt(1+x^2))

  Parameters:
    `x` - float
  Returns:
    float asinh(x)

### asinh

    public static final double asinh(double x)

  Hyperbolic arcsin.

  Hyperbolic arc sine: log (x+sqrt(1+x^2))

  Parameters:
    `x` - double
  Returns:
    double asinh(x)

### sinh

    public static final float sinh(float x)

  Hyperbolic sin.

  Hyperbolic sine: (e^x-e^-x)/2

  Parameters:
    `x` - float
  Returns:
    float sinh(x)

### sinh

    public static final double sinh(double x)

  Hyperbolic sin.

  Hyperbolic sine: (e^x-e^-x)/2

  Parameters:
    `x` - double
  Returns:
    double sinh(x)

### sign

    public static final int sign(short x)

  Return sign of number.

  Parameters:
    `x` - short
  Returns:
    int sign -1, 1

### sign

    public static final int sign(int x)

  Return sign of number.

  Parameters:
    `x` - int
  Returns:
    int sign -1, 1

### sign

    public static final int sign(long x)

  Return sign of number.

  Parameters:
    `x` - long
  Returns:
    int sign -1, 1

### sign

    public static final int sign(float x)

  Return sign of number.

  Parameters:
    `x` - float
  Returns:
    int sign -1, 1

### sign

    public static final int sign(double x)

  Return sign of number.

  Parameters:
    `x` - double
  Returns:
    int sign -1, 1

### odd

    public static final boolean odd(short x)

  Check if number is odd.

  Parameters:
    `x` - short
  Returns:
    boolean

### odd

    public static final boolean odd(int x)

  Check if number is odd.

  Parameters:
    `x` - int
  Returns:
    boolean

### odd

    public static final boolean odd(long x)

  Check if number is odd.

  Parameters:
    `x` - long
  Returns:
    boolean

### even

    public static final boolean even(short x)

  Check if number is even.

  Parameters:
    `x` - short
  Returns:
    boolean

### even

    public static final boolean even(int x)

  Check if number is even.

  Parameters:
    `x` - int
  Returns:
    boolean

### even

    public static final boolean even(long x)

  Check if number is even.

  Parameters:
    `x` - long
  Returns:
    boolean

### signedToInt

    public static final int signedToInt(byte b)

  Converts a byte in the range of -128 to 127 to an int in the range 0 - 255.

  Parameters:
    `b` - (-128 <= b <= 127)
  Returns:
    int (0 <= b <= 255)

### signedToInt

    public static final int signedToInt(short w)

  Converts a short in the range of -32768 to 32767 to an int in the range 0 - 65535.

  Parameters:
    `w` - (-32768 <= b <= 32767)
  Returns:
    int (0 <= b <= 65535)

### signedToLong

    public static final long signedToLong(int x)

  Convert an int in the range of -2147483648 to 2147483647 to a long in the range 0 to 4294967295.

  Parameters:
    `x` - (-2147483648 <= x <= 2147483647)
  Returns:
    long (0 <= x <= 4294967295)

### wordToByte

    public static final int wordToByte(int w)

  Converts an int in the range of 0 - 65535 to an int in the range of 0 - 255.

  Parameters:
    `w` - int (0 <= w <= 65535)
  Returns:
    int (0 <= w <= 255)

### BuildShortBE

    public static final short BuildShortBE(byte[] bytevec,
                                           int offset)

  Build short out of bytes (in big endian order).

  Parameters:
    `bytevec` - bytes
    `offset` - byte offset
  Returns:
    short

### BuildShortLE

    public static final short BuildShortLE(byte[] bytevec,
                                           int offset)

  Build short out of bytes (in little endian order).

  Parameters:
    `bytevec` - bytes
    `offset` - byte offset
  Returns:
    short

### BuildShort

    public static final short BuildShort(byte[] bytevec,
                                         int offset,
                                         boolean MSBFirst)

  Build short out of bytes.

  Parameters:
    `bytevec` - bytes
    `offset` - byte offset
    `MSBFirst` - BE or LE?
  Returns:
    short

### BuildShortBE

    public static final short BuildShortBE(byte[] bytevec,
                                           boolean MSBFirst)

  Build short out of bytes (in big endian order).

  Parameters:
    `bytevec` - bytes
    `MSBFirst` - BE or LE?
  Returns:
    short

### BuildShortLE

    public static final short BuildShortLE(byte[] bytevec,
                                           boolean MSBFirst)

  Build short out of bytes (in little endian order).

  Parameters:
    `bytevec` - bytes
    `MSBFirst` - BE or LE?
  Returns:
    short

### BuildShort

    public static final short BuildShort(byte[] bytevec,
                                         boolean MSBFirst)

  Build short out of bytes.

  Parameters:
    `bytevec` - bytes
    `MSBFirst` - BE or LE?
  Returns:
    short

### BuildIntegerBE

    public static final int BuildIntegerBE(byte[] bytevec,
                                           int offset)

  Build int out of bytes (in big endian order).

  Parameters:
    `bytevec` - bytes
    `offset` - byte offset
  Returns:
    int

### BuildIntegerLE

    public static final int BuildIntegerLE(byte[] bytevec,
                                           int offset)

  Build int out of bytes (in little endian order).

  Parameters:
    `bytevec` - bytes
    `offset` - byte offset
  Returns:
    int

### BuildInteger

    public static final int BuildInteger(byte[] bytevec,
                                         int offset,
                                         boolean MSBFirst)

  Build int out of bytes.

  Parameters:
    `bytevec` - bytes
    `offset` - byte offset
    `MSBFirst` - BE or LE?
  Returns:
    int

### BuildIntegerBE

    public static final int BuildIntegerBE(byte[] bytevec)

  Build int out of bytes (in big endian order).

  Parameters:
    `bytevec` - bytes
  Returns:
    int

### BuildIntegerLE

    public static final int BuildIntegerLE(byte[] bytevec)

  Build int out of bytes (in little endian order).

  Parameters:
    `bytevec` - bytes
  Returns:
    int

### BuildInteger

    public static final int BuildInteger(byte[] bytevec,
                                         boolean MSBFirst)

  Build int out of bytes.

  Parameters:
    `bytevec` - bytes
    `MSBFirst` - BE or LE?
  Returns:
    int

### BuildLongBE

    public static final long BuildLongBE(byte[] bytevec,
                                         int offset)

  Build long out of bytes (in big endian order).

  Parameters:
    `bytevec` - bytes
    `offset` - byte offset
  Returns:
    long

### BuildLongLE

    public static final long BuildLongLE(byte[] bytevec,
                                         int offset)

  Build long out of bytes (in little endian order).

  Parameters:
    `bytevec` - bytes
    `offset` - byte offset
  Returns:
    long

### BuildLong

    public static final long BuildLong(byte[] bytevec,
                                       int offset,
                                       boolean MSBFirst)

  Build long out of bytes.

  Parameters:
    `bytevec` - bytes
    `offset` - byte offset
    `MSBFirst` - BE or LE?
  Returns:
    long

### BuildLongBE

    public static final long BuildLongBE(byte[] bytevec)

  Build long out of bytes (in big endian order).

  Parameters:
    `bytevec` - bytes
  Returns:
    long

### BuildLongLE

    public static final long BuildLongLE(byte[] bytevec)

  Build long out of bytes (in little endian order).

  Parameters:
    `bytevec` - bytes
  Returns:
    long

### BuildLong

    public static final long BuildLong(byte[] bytevec,
                                       boolean MSBFirst)

  Build long out of bytes.

  Parameters:
    `bytevec` - bytes
    `MSBFirst` - BE or LE?
  Returns:
    long

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details