add acosh, atanh and tanh

This commit is contained in:
rolux 2012-06-13 00:04:28 +02:00
parent fd04452db9
commit c2ae5d3f4c

View file

@ -1,5 +1,13 @@
'use strict';
/*@
Ox.acosh <f> Inverse hyperbolic cosine
Missing from `Math`.
@*/
Ox.acosh = function(x) {
return Math.log(x + Math.sqrt(x * x - 1));
};
/*@
Ox.asinh <f> Inverse hyperbolic sine
Missing from `Math`.
@ -10,6 +18,14 @@ Ox.asinh = function(x) {
return Math.log(x + Math.sqrt(x * x + 1));
};
/*@
Ox.atanh <f> Inverse hyperbolic tangent
Missing from `Math`.
@*/
Ox.atanh = function(x) {
return 0.5 * Math.log((1 + x) / (1 - x));
};
/*@
Ox.deg <f> Takes radians, returns degrees
Missing from `Math`.
@ -140,3 +156,11 @@ Ox.sinh <f> Hyperbolic sine
Ox.sinh = function(x) {
return (Math.exp(x) - Math.exp(-x)) / 2;
};
/*@
Ox.tanh <f> Hyperbolic tangent
Missing from `Math`.
@*/
Ox.tanh = function(x) {
return (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x));
};