ph-math/src/main/java/com/helger/numbercruncher/mathutils/BigFunctions.java
public static BigDecimal arctan (@Nonnull final BigDecimal x, final int scale)
  {
    // Check that |x| < 1.
    if (x.abs ().compareTo (BigDecimal.ONE) >= 0)
    {
      throw new IllegalArgumentException ("|x| >= 1: " + x);
    }

    // If x is negative, return -arctan(-x).
    if (x.signum () == -1)
    {
      return arctan (x.negate (), scale).negate ();
    }
    return _arctanTaylor (x, scale);
  }
public static BigDecimal arctan (@Nonnull final BigDecimal x, final int scale)
  {
    // Check that |x| < 1.
    if (x.abs ().compareTo (BigDecimal.ONE) >= 0)
    {
      throw new IllegalArgumentException ("|x| >= 1: " + x);
    }

    // If x is negative, return -arctan(-x).
    if (x.signum () == -1)
    {
      return arctan (x.negate (), scale).negate ();
    }
    return _arctanTaylor (x, scale);
  }
public static BigDecimal arctan ( @ Nonnull final BigDecimal x , final int scale ) { // Check that |x| < 1. if ( x . abs ( ) . compareTo ( BigDecimal . ONE ) >= 0 ) { throw new IllegalArgumentException ( "|x| >= 1: " + x ) ; } // If x is negative, return -arctan(-x). if ( x . signum ( ) == - 1 ) { return arctan ( x . negate ( ) , scale ) . negate ( ) ; } return _arctanTaylor ( x , scale ) ; }
Compute the arctangent of x to a given scale, |x| &lt; 1

@param x
the value of x
@param scale
the desired scale of the result
@return the result value
Compute the arctangent of x to a given scale |x| &lt ; 1