diff --git a/.gitignore b/.gitignore index b248083..c004aef 100644 --- a/.gitignore +++ b/.gitignore @@ -347,3 +347,7 @@ healthchecksdb # Backup folder for Package Reference Convert tool in Visual Studio 2017 MigrationBackup/ + +# JetBrains settings +.idea + diff --git a/DecimalEx/DecimalEx.cs b/DecimalEx/DecimalEx.cs index 9adaa65..30b0cd7 100644 --- a/DecimalEx/DecimalEx.cs +++ b/DecimalEx/DecimalEx.cs @@ -629,5 +629,31 @@ public static decimal Remainder(decimal d1, decimal d2) return d1; } + + /// + /// Hyperbolic sine. + /// + /// The hyperbolic angle. + /// The hyperbolic sine of the given angle. + public static decimal Sinh(decimal x) => (Exp(x) - Exp(-x)) / 2; + + /// + /// Hyperbolic cosine. + /// + /// The hyperbolic angle. + /// The hyperbolic cosine of the given angle. + public static decimal Cosh(decimal x) => (Exp(x) + Exp(-x)) / 2; + + /// + /// Hyperbolic tangent. + /// + /// The hyperbolic angle. + /// The hyperbolic tangent of the given angle. + public static decimal Tanh(decimal x) + { + decimal a = Exp(x); + decimal b = Exp(-x); + return (a - b) / (a + b); + } } }