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

Function Cosh

extern/ttmath/ttmath.h:1200–1223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1198 */
1199 template<class ValueType>
1200 ValueType Cosh(const ValueType & x, ErrorCode * err = 0)
1201 {
1202 if( x.IsNan() )
1203 {
1204 if( err )
1205 *err = err_improper_argument;
1206
1207 return x; // NaN
1208 }
1209
1210 ValueType ex, emx;
1211 uint c = 0;
1212
1213 c += ex.Exp(x);
1214 c += emx.Exp(-x);
1215
1216 c += ex.Add(emx);
1217 c += ex.exponent.SubOne();
1218
1219 if( err )
1220 *err = c ? err_overflow : err_ok;
1221
1222 return ex;
1223 }
1224
1225
1226 /*!

Callers

nothing calls this directly

Calls 2

AddMethod · 0.45
SubOneMethod · 0.45

Tested by

no test coverage detected