PageRenderTime 12ms CodeModel.GetById 5ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/cln-1.3.2/src/real/transcendental/cl_R_cosh.cc

#
C++ | 34 lines | 18 code | 9 blank | 7 comment | 3 complexity | 32d8cbea4c8ed740a46a11b0661ca5ed MD5 | raw file
Possible License(s): GPL-2.0
 1// cosh().
 2
 3// General includes.
 4#include "base/cl_sysdep.h"
 5
 6// Specification.
 7#include "cln/real.h"
 8
 9
10// Implementation.
11
12#include "cln/float.h"
13#include "real/cl_R.h"
14
15namespace cln {
16
17const cl_R cosh (const cl_R& x)
18{
19// Methode:
20// x rational -> bei x=0 1 als Ergebnis, sonst x in Float umwandeln.
21// x Float -> bekannt.
22
23	if (rationalp(x)) {
24		DeclareType(cl_RA,x);
25		if (zerop(x)) // x=0 -> 1 als Ergebnis
26			return 1;
27		return cosh(cl_float(x)); // sonst in Float umwandeln
28	} else {
29		DeclareType(cl_F,x);
30		return cosh(x);
31	}
32}
33
34}  // namespace cln