PageRenderTime 44ms CodeModel.GetById 18ms 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. // General includes.
  3. #include "base/cl_sysdep.h"
  4. // Specification.
  5. #include "cln/real.h"
  6. // Implementation.
  7. #include "cln/float.h"
  8. #include "real/cl_R.h"
  9. namespace cln {
  10. const cl_R cosh (const cl_R& x)
  11. {
  12. // Methode:
  13. // x rational -> bei x=0 1 als Ergebnis, sonst x in Float umwandeln.
  14. // x Float -> bekannt.
  15. if (rationalp(x)) {
  16. DeclareType(cl_RA,x);
  17. if (zerop(x)) // x=0 -> 1 als Ergebnis
  18. return 1;
  19. return cosh(cl_float(x)); // sonst in Float umwandeln
  20. } else {
  21. DeclareType(cl_F,x);
  22. return cosh(x);
  23. }
  24. }
  25. } // namespace cln