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