diff options
Diffstat (limited to 'math.c')
-rw-r--r-- | math.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -88,6 +88,15 @@ math_atan(obj, x) return rb_float_new(atan(RFLOAT(x)->value)); } +#ifndef HAVE_COSH +double +cosh(x) + double x; +{ + return (exp(x) + exp(-x)) / 2; +} +#endif + static VALUE math_cosh(obj, x) VALUE obj, x; @@ -96,6 +105,15 @@ math_cosh(obj, x) return rb_float_new(cosh(RFLOAT(x)->value)); } +#ifndef HAVE_SINH +double +sinh(x) + double x; +{ + return (exp(x) - exp(-x)) / 2; +} +#endif + static VALUE math_sinh(obj, x) VALUE obj, x; @@ -104,6 +122,15 @@ math_sinh(obj, x) return rb_float_new(sinh(RFLOAT(x)->value)); } +#ifndef HAVE_SINH +double +tanh(x) + double x; +{ + return sinh(x) / cosh(x); +} +#endif + static VALUE math_tanh(obj, x) VALUE obj, x; |