Package cds.healpix.common.math

# Class FastMath

java.lang.Object
cds.healpix.common.math.FastMath

public final class FastMath extends Object
Comes from the Apache FastMath class, and is thus under the Apache licence.

Author:
  F.-X. Pineau

## Field Summary

Fields
Modifier and Type
Field
Description
`static final double`
`SAFE_MIN`

## Constructor Summary

Constructors
Constructor
Description
`FastMath()`

## Method Summary

Modifier and Type
Method
Description
`static double`
`acos(double x)`
Compute the arc cosine of a number.
`static double`
`asin(double x)`
Compute the arc sine of a number.
`static double`
`atan(double x)`
Arctangent function
`static double`
`copySign(double magnitude, double sign)`
Returns the first argument with the sign of the second argument.
`static double`
`cosQ(double xa)`
Compute cosine in the first quadrant by subtracting input from PI/2 and then calling sinQ.
`static double`
`sinQ(double xa, double xb)`
Compute sine over the first quadrant (0 < x < pi/2).
`static double`
`sqrt(double a)`
Compute the square root of a number.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### SAFE_MIN

public static final double SAFE_MIN

See Also:
  - Constant Field Values

## Constructor Details

### FastMath

public FastMath()

## Method Details

### sinQ

public static double sinQ(double xa, double xb)
Compute sine over the first quadrant (0 < x < pi/2). Use combination of table lookup and rational polynomial expansion.

Parameters:
  `xa` - number from which sine is requested
  `xb` - second param
Returns:
  sin(xa + xb)

### cosQ

public static double cosQ(double xa)
Compute cosine in the first quadrant by subtracting input from PI/2 and then calling sinQ. This is more accurate as the input approaches PI/2.

Parameters:
  `xa` - number from which cosine is requested
Returns:
  cos(xa + xb)

### asin

public static double asin(double x)
Compute the arc sine of a number.

Parameters:
  `x` - number on which evaluation is done
Returns:
  arc sine of x

### atan

public static double atan(double x)
Arctangent function

Parameters:
  `x` - a number
Returns:
  atan(x)

### acos

public static double acos(double x)
Compute the arc cosine of a number.

Parameters:
  `x` - number on which evaluation is done
Returns:
  arc cosine of x

### sqrt

public static double sqrt(double a)
Compute the square root of a number.

Note: this implementation currently delegates to `Math.sqrt(double)`

Parameters:
  `a` - number on which evaluation is done
Returns:
  square root of a

### copySign

public static double copySign(double magnitude, double sign)
Returns the first argument with the sign of the second argument. A NaN `sign` argument is treated as positive.

Parameters:
  `magnitude` - the value to return
  `sign` - the sign for the returned value
Returns:
  the magnitude with the same sign as the `sign` argument