Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,7 @@ healthchecksdb

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

# JetBrains settings
.idea

26 changes: 26 additions & 0 deletions DecimalEx/DecimalEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -629,5 +629,31 @@ public static decimal Remainder(decimal d1, decimal d2)

return d1;
}

/// <summary>
/// Hyperbolic sine.
/// </summary>
/// <param name="x">The hyperbolic angle.</param>
/// <returns>The hyperbolic sine of the given angle.</returns>
public static decimal Sinh(decimal x) => (Exp(x) - Exp(-x)) / 2;

/// <summary>
/// Hyperbolic cosine.
/// </summary>
/// <param name="x">The hyperbolic angle.</param>
/// <returns>The hyperbolic cosine of the given angle.</returns>
public static decimal Cosh(decimal x) => (Exp(x) + Exp(-x)) / 2;

/// <summary>
/// Hyperbolic tangent.
/// </summary>
/// <param name="x">The hyperbolic angle.</param>
/// <returns>The hyperbolic tangent of the given angle.</returns>
public static decimal Tanh(decimal x)
{
decimal a = Exp(x);
decimal b = Exp(-x);
return (a - b) / (a + b);
}
}
}