MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / ATan

Function ATan

extern/ttmath/ttmath.h:1079–1107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 /*!

Callers 2

ATgFunction · 0.85
ACotFunction · 0.85

Calls 6

ATanGreaterThanPlusOneFunction · 0.85
ATan01Function · 0.85
SetOneMethod · 0.80
IsSignMethod · 0.80
AbsMethod · 0.80
ChangeSignMethod · 0.80

Tested by

no test coverage detected