| 1077 | */ |
| 1078 | template<class ValueType> |
| 1079 | ValueType ATan(ValueType x) |
| 1080 | { |
| 1081 | using namespace auxiliaryfunctions; |
| 1082 | |
| 1083 | ValueType one, result; |
| 1084 | one.SetOne(); |
| 1085 | bool change_sign = false; |
| 1086 | |
| 1087 | if( x.IsNan() ) |
| 1088 | return x; |
| 1089 | |
| 1090 | // if x is negative we're using the formula: |
| 1091 | // atan(-x) = -atan(x) |
| 1092 | if( x.IsSign() ) |
| 1093 | { |
| 1094 | change_sign = true; |
| 1095 | x.Abs(); |
| 1096 | } |
| 1097 | |
| 1098 | if( x.GreaterWithoutSignThan(one) ) |
| 1099 | result = ATanGreaterThanPlusOne(x); |
| 1100 | else |
| 1101 | result = ATan01(x); |
| 1102 | |
| 1103 | if( change_sign ) |
| 1104 | result.ChangeSign(); |
| 1105 | |
| 1106 | return result; |
| 1107 | } |
| 1108 | |
| 1109 | |
| 1110 | /*! |
no test coverage detected