1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 23:15:40 +00:00

Move Math/Numerics float extensions to child namespaces (#7)

This commit is contained in:
Oliver Booth 2022-04-21 18:13:20 +01:00
parent c8d8e212e2
commit 0af2c7fb8e
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
5 changed files with 350 additions and 333 deletions

View File

@ -1,6 +1,5 @@
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using X10D.Numerics;
namespace X10D.Math;

View File

@ -0,0 +1,313 @@
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
namespace X10D.Math;
/// <summary>
/// Extension methods for <see cref="float" />.
/// </summary>
public static class SingleExtensions
{
/// <summary>
/// Returns the arccosine of the specified value.
/// </summary>
/// <param name="value">
/// The value representing a cosine, which must be greater than or equal to -1, but less than or equal to 1.
/// </param>
/// <returns>
/// The arccosine of <paramref name="value" />, θ, measured in radians; such that 0 ≤ θ ≤ π. If <paramref name="value" />
/// is equal to <see cref="float.NaN" />, less than -1, or greater than 1, <see cref="float.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Acos(this float value)
{
return MathF.Acos(value);
}
/// <summary>
/// Returns the hyperbolic arccosine of the specified value.
/// </summary>
/// <param name="value">
/// The value representing a hyperbolic cosine, which must be greater than or equal to 1, but less than or equal to
/// <see cref="float.PositiveInfinity" />.
/// </param>
/// <returns>
/// The hyperbolic arccosine of <paramref name="value" />, θ, measured in radians; such that 0 ≤ θ ≤ ∞. If
/// <paramref name="value" /> is less than 1 or equal to <see cref="float.NaN" />, <see cref="float.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Acosh(this float value)
{
return MathF.Acosh(value);
}
/// <summary>
/// Returns the arcsine of the specified value.
/// </summary>
/// <param name="value">
/// The value representing a sine, which must be greater than or equal to -1, but less than or equal to 1.
/// </param>
/// <returns>
/// The arccosine of <paramref name="value" />, θ, measured in radians; such that π/2 ≤ θ ≤ π/2. If
/// <paramref name="value" /> is equal to <see cref="float.NaN" />, less than -1, or greater than 1,
/// <see cref="float.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Asin(this float value)
{
return MathF.Asin(value);
}
/// <summary>
/// Returns the hyperbolic arcsine of the specified value.
/// </summary>
/// <param name="value">
/// The value representing a hyperbolic sine, which must be greater than or equal to 1, but less than or equal to
/// <see cref="float.PositiveInfinity" />.
/// </param>
/// <returns>
/// The hyperbolic arccosine of <paramref name="value" />, measured in radians. If <paramref name="value" /> is equal to
/// <see cref="float.NaN" />, <see cref="float.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Asinh(this float value)
{
return MathF.Asinh(value);
}
/// <summary>
/// Returns the arctangent of the specified value.
/// </summary>
/// <param name="value">
/// The value representing a tangent, which must be greater than or equal to -1, but less than or equal to 1.
/// </param>
/// <returns>
/// The arctangent of <paramref name="value" />, θ, measured in radians; such that π/2 ≤ θ ≤ π/2. If
/// <paramref name="value" /> is equal to <see cref="float.NaN" />, <see cref="float.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Atan(this float value)
{
return MathF.Atan(value);
}
/// <summary>
/// Returns the hyperbolic arctangent of the specified value.
/// </summary>
/// <param name="value">
/// The value representing a hyperbolic tangent, which must be greater than or equal to 1, but less than or equal to
/// <see cref="float.PositiveInfinity" />.
/// </param>
/// <returns>
/// The hyperbolic arctangent of <paramref name="value" />, θ, measured in radians; such that -∞ &lt; θ &lt; -1, or 1 &lt;
/// θ &lt; ∞. If <paramref name="value" /> is equal to <see cref="float.NaN" />, less than -1, or greater than 1,
/// <see cref="float.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Atanh(this float value)
{
return MathF.Atanh(value);
}
/// <summary>
/// Returns the cosine of the specified angle.
/// </summary>
/// <param name="value">The angle, measured in radians.</param>
/// <returns>
/// The cosine of <paramref name="value" />. If <paramref name="value" /> is equal to <see cref="float.NaN" />,
/// <see cref="float.NegativeInfinity" />, or <see cref="float.PositiveInfinity" />, this method returns
/// <see cref="float.NaN" />.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Cos(this float value)
{
return MathF.Cos(value);
}
/// <summary>
/// Returns the hyperbolic cosine of the specified angle.
/// </summary>
/// <param name="value">The angle, measured in radians.</param>
/// <returns>
/// The hyperbolic cosine of <paramref name="value" />. If <paramref name="value" /> is equal to
/// <see cref="float.NegativeInfinity" /> or <see cref="float.PositiveInfinity" />,
/// <see cref="float.PositiveInfinity" /> is returned. If <paramref name="value" /> is equal to
/// <see cref="float.NaN" />, <see cref="double.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Cosh(this float value)
{
return MathF.Cosh(value);
}
/// <summary>
/// Returns an integer that indicates the sign of this single-precision floating-point number.
/// </summary>
/// <param name="value">A signed number.</param>
/// <returns>
/// A number that indicates the sign of <paramref name="value" />, as shown in the following table.
///
/// <list type="table">
/// <listheader>
/// <term>Return value</term>
/// <description>Meaning</description>
/// </listheader>
///
/// <item>
/// <term>-1</term>
/// <description><paramref name="value" /> is less than zero.</description>
/// </item>
/// <item>
/// <term>0</term>
/// <description><paramref name="value" /> is equal to zero.</description>
/// </item>
/// <item>
/// <term>1</term>
/// <description><paramref name="value" /> is greater than zero.</description>
/// </item>
/// </list>
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static int Sign(this float value)
{
return MathF.Sign(value);
}
/// <summary>
/// Returns the square root of this single-precision floating-point number.
/// </summary>
/// <param name="value">The number whose square root is to be found.</param>
/// <returns>
/// One of the values in the following table.
///
/// <list type="table">
/// <listheader>
/// <term>Return value</term>
/// <description>Meaning</description>
/// </listheader>
///
/// <item>
/// <term>The positive square root of <paramref name="value" />.</term>
/// <description><paramref name="value" /> is greater than or equal to 0.</description>
/// </item>
/// <item>
/// <term><see cref="float.NaN" /></term>
/// <description><paramref name="value" /> is equal to <see cref="float.NaN" /> or is negative.</description>
/// </item>
/// <item>
/// <term><see cref="float.PositiveInfinity" /></term>
/// <description><paramref name="value" /> is equal to <see cref="float.PositiveInfinity" />.</description>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// For negative input, this method returns <see cref="float.NaN" />. To receive a complex number, see
/// <see cref="Numerics.SingleExtensions.ComplexSqrt" />.
/// </remarks>
/// <seealso cref="Numerics.SingleExtensions.ComplexSqrt" />
/// <author>SLenik https://stackoverflow.com/a/6755197/1467293</author>
/// <license>CC BY-SA 3.0</license>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Sqrt(this float value)
{
switch (value)
{
case 0:
return 0;
case < 0 or float.NaN:
return float.NaN;
case float.PositiveInfinity:
return float.PositiveInfinity;
}
float previous;
float current = MathF.Sqrt(value);
do
{
previous = current;
if (previous == 0.0f)
{
return 0;
}
current = (previous + value / previous) / 2;
} while (MathF.Abs(previous - current) > float.Epsilon);
return current;
}
/// <summary>
/// Returns the sine of the specified angle.
/// </summary>
/// <param name="value">The angle, measured in radians.</param>
/// <returns>
/// The sine of <paramref name="value" />. If <paramref name="value" /> is equal to <see cref="double.NaN" />,
/// <see cref="double.NegativeInfinity" />, or <see cref="double.PositiveInfinity" />, this method returns
/// <see cref="double.NaN" />.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Sin(this float value)
{
return MathF.Sin(value);
}
/// <summary>
/// Returns the hyperbolic sine of the specified angle.
/// </summary>
/// <param name="value">The angle, measured in radians.</param>
/// <returns>
/// The hyperbolic sine of <paramref name="value" />. If <paramref name="value" /> is equal to <see cref="float.NaN" />,
/// <see cref="float.NegativeInfinity" />, or <see cref="float.PositiveInfinity" />, this method returns
/// <see cref="float.NaN" />.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Sinh(this float value)
{
return MathF.Sinh(value);
}
/// <summary>
/// Returns the tangent of the specified angle.
/// </summary>
/// <param name="value">The angle, measured in radians.</param>
/// <returns>
/// The tangent of <paramref name="value" />. If <paramref name="value" /> is equal to <see cref="float.NaN" />,
/// <see cref="float.NegativeInfinity" />, or <see cref="float.PositiveInfinity" />, this method returns
/// <see cref="float.NaN" />.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Tan(this float value)
{
return MathF.Sin(value);
}
/// <summary>
/// Returns the hyperbolic tangent of the specified angle.
/// </summary>
/// <param name="value">The angle, measured in radians.</param>
/// <returns>
/// The hyperbolic tangent of <paramref name="value" />. If <paramref name="value" /> is equal to
/// <see cref="float.NegativeInfinity" />, this method returns -1. If <paramref name="value" /> is equal to
/// <see cref="float.PositiveInfinity" />, this method returns 1. If <paramref name="value" /> is equal to
/// <see cref="float.NaN" />, this method returns <see cref="float.NaN" />.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Tanh(this float value)
{
return MathF.Tanh(value);
}
}

View File

@ -6,7 +6,7 @@ using X10D.Math;
namespace X10D.Numerics;
/// <summary>
/// Extension methods which accept or return types within <see cref="System.Numerics" />.
/// Extension methods for <see cref="double" />.
/// </summary>
public static class DoubleExtensions
{

View File

@ -0,0 +1,35 @@
using System.Diagnostics.Contracts;
using System.Numerics;
using System.Runtime.CompilerServices;
using X10D.Math;
namespace X10D.Numerics;
/// <summary>
/// Extension methods for <see cref="float" />.
/// </summary>
public static class SingleExtensions
{
/// <summary>
/// Returns the complex square root of this single-precision floating-point number.
/// </summary>
/// <param name="value">The number whose square root is to be found.</param>
/// <returns>The square root of <paramref name="value" />.</returns>
/// <seealso cref="X10D.Math.SingleExtensions.Sqrt" />
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static Complex ComplexSqrt(this float value)
{
switch (value)
{
case float.PositiveInfinity:
case float.NegativeInfinity:
return Complex.Infinity;
case float.NaN:
return Complex.NaN;
}
float absoluteSqrt = MathF.Abs(value).Sqrt();
return new Complex(absoluteSqrt, value >= 0 ? 0 : 1);
}
}

View File

@ -1,177 +1,10 @@
using System.Diagnostics.Contracts;
using System.Numerics;
using System.Runtime.CompilerServices;
namespace X10D;
namespace X10D;
/// <summary>
/// Extension methods for <see cref="float" />.
/// </summary>
public static class SingleExtensions
{
/// <summary>
/// Returns the arccosine of the specified value.
/// </summary>
/// <param name="value">
/// The value representing a cosine, which must be greater than or equal to -1, but less than or equal to 1.
/// </param>
/// <returns>
/// The arccosine of <paramref name="value" />, θ, measured in radians; such that 0 ≤ θ ≤ π. If <paramref name="value" />
/// is equal to <see cref="float.NaN" />, less than -1, or greater than 1, <see cref="float.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Acos(this float value)
{
return MathF.Acos(value);
}
/// <summary>
/// Returns the hyperbolic arccosine of the specified value.
/// </summary>
/// <param name="value">
/// The value representing a hyperbolic cosine, which must be greater than or equal to 1, but less than or equal to
/// <see cref="float.PositiveInfinity" />.
/// </param>
/// <returns>
/// The hyperbolic arccosine of <paramref name="value" />, θ, measured in radians; such that 0 ≤ θ ≤ ∞. If
/// <paramref name="value" /> is less than 1 or equal to <see cref="float.NaN" />, <see cref="float.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Acosh(this float value)
{
return MathF.Acosh(value);
}
/// <summary>
/// Returns the arcsine of the specified value.
/// </summary>
/// <param name="value">
/// The value representing a sine, which must be greater than or equal to -1, but less than or equal to 1.
/// </param>
/// <returns>
/// The arccosine of <paramref name="value" />, θ, measured in radians; such that π/2 ≤ θ ≤ π/2. If
/// <paramref name="value" /> is equal to <see cref="float.NaN" />, less than -1, or greater than 1,
/// <see cref="float.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Asin(this float value)
{
return MathF.Asin(value);
}
/// <summary>
/// Returns the hyperbolic arcsine of the specified value.
/// </summary>
/// <param name="value">
/// The value representing a hyperbolic sine, which must be greater than or equal to 1, but less than or equal to
/// <see cref="float.PositiveInfinity" />.
/// </param>
/// <returns>
/// The hyperbolic arccosine of <paramref name="value" />, measured in radians. If <paramref name="value" /> is equal to
/// <see cref="float.NaN" />, <see cref="float.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Asinh(this float value)
{
return MathF.Asinh(value);
}
/// <summary>
/// Returns the arctangent of the specified value.
/// </summary>
/// <param name="value">
/// The value representing a tangent, which must be greater than or equal to -1, but less than or equal to 1.
/// </param>
/// <returns>
/// The arctangent of <paramref name="value" />, θ, measured in radians; such that π/2 ≤ θ ≤ π/2. If
/// <paramref name="value" /> is equal to <see cref="float.NaN" />, <see cref="float.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Atan(this float value)
{
return MathF.Atan(value);
}
/// <summary>
/// Returns the hyperbolic arctangent of the specified value.
/// </summary>
/// <param name="value">
/// The value representing a hyperbolic tangent, which must be greater than or equal to 1, but less than or equal to
/// <see cref="float.PositiveInfinity" />.
/// </param>
/// <returns>
/// The hyperbolic arctangent of <paramref name="value" />, θ, measured in radians; such that -∞ &lt; θ &lt; -1, or 1 &lt;
/// θ &lt; ∞. If <paramref name="value" /> is equal to <see cref="float.NaN" />, less than -1, or greater than 1,
/// <see cref="float.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Atanh(this float value)
{
return MathF.Atanh(value);
}
/// <summary>
/// Returns the complex square root of this single-precision floating-point number.
/// </summary>
/// <param name="value">The number whose square root is to be found.</param>
/// <returns>The square root of <paramref name="value" />.</returns>
/// <seealso cref="Sqrt" />
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static Complex ComplexSqrt(this float value)
{
switch (value)
{
case float.PositiveInfinity:
case float.NegativeInfinity:
return Complex.Infinity;
case float.NaN:
return Complex.NaN;
}
float absoluteSqrt = MathF.Abs(value).Sqrt();
return new Complex(absoluteSqrt, value >= 0 ? 0 : 1);
}
/// <summary>
/// Returns the cosine of the specified angle.
/// </summary>
/// <param name="value">The angle, measured in radians.</param>
/// <returns>
/// The cosine of <paramref name="value" />. If <paramref name="value" /> is equal to <see cref="float.NaN" />,
/// <see cref="float.NegativeInfinity" />, or <see cref="float.PositiveInfinity" />, this method returns
/// <see cref="float.NaN" />.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Cos(this float value)
{
return MathF.Cos(value);
}
/// <summary>
/// Returns the hyperbolic cosine of the specified angle.
/// </summary>
/// <param name="value">The angle, measured in radians.</param>
/// <returns>
/// The hyperbolic cosine of <paramref name="value" />. If <paramref name="value" /> is equal to
/// <see cref="float.NegativeInfinity" /> or <see cref="float.PositiveInfinity" />,
/// <see cref="float.PositiveInfinity" /> is returned. If <paramref name="value" /> is equal to
/// <see cref="float.NaN" />, <see cref="double.NaN" /> is returned.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Cosh(this float value)
{
return MathF.Cosh(value);
}
/// <summary>
/// Converts the current angle in degrees to its equivalent represented in radians.
/// </summary>
@ -290,167 +123,4 @@ public static class SingleExtensions
{
return MathF.Round(value / nearest) * nearest;
}
/// <summary>
/// Returns an integer that indicates the sign of this single-precision floating-point number.
/// </summary>
/// <param name="value">A signed number.</param>
/// <returns>
/// A number that indicates the sign of <paramref name="value" />, as shown in the following table.
///
/// <list type="table">
/// <listheader>
/// <term>Return value</term>
/// <description>Meaning</description>
/// </listheader>
///
/// <item>
/// <term>-1</term>
/// <description><paramref name="value" /> is less than zero.</description>
/// </item>
/// <item>
/// <term>0</term>
/// <description><paramref name="value" /> is equal to zero.</description>
/// </item>
/// <item>
/// <term>1</term>
/// <description><paramref name="value" /> is greater than zero.</description>
/// </item>
/// </list>
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static int Sign(this float value)
{
return MathF.Sign(value);
}
/// <summary>
/// Returns the sine of the specified angle.
/// </summary>
/// <param name="value">The angle, measured in radians.</param>
/// <returns>
/// The sine of <paramref name="value" />. If <paramref name="value" /> is equal to <see cref="double.NaN" />,
/// <see cref="double.NegativeInfinity" />, or <see cref="double.PositiveInfinity" />, this method returns
/// <see cref="double.NaN" />.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Sin(this float value)
{
return MathF.Sin(value);
}
/// <summary>
/// Returns the hyperbolic sine of the specified angle.
/// </summary>
/// <param name="value">The angle, measured in radians.</param>
/// <returns>
/// The hyperbolic sine of <paramref name="value" />. If <paramref name="value" /> is equal to <see cref="float.NaN" />,
/// <see cref="float.NegativeInfinity" />, or <see cref="float.PositiveInfinity" />, this method returns
/// <see cref="float.NaN" />.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Sinh(this float value)
{
return MathF.Sinh(value);
}
/// <summary>
/// Returns the square root of this single-precision floating-point number.
/// </summary>
/// <param name="value">The number whose square root is to be found.</param>
/// <returns>
/// One of the values in the following table.
///
/// <list type="table">
/// <listheader>
/// <term>Return value</term>
/// <description>Meaning</description>
/// </listheader>
///
/// <item>
/// <term>The positive square root of <paramref name="value" />.</term>
/// <description><paramref name="value" /> is greater than or equal to 0.</description>
/// </item>
/// <item>
/// <term><see cref="float.NaN" /></term>
/// <description><paramref name="value" /> is equal to <see cref="float.NaN" /> or is negative.</description>
/// </item>
/// <item>
/// <term><see cref="float.PositiveInfinity" /></term>
/// <description><paramref name="value" /> is equal to <see cref="float.PositiveInfinity" />.</description>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// For negative input, this method returns <see cref="float.NaN" />. To receive a complex number, see
/// <see cref="ComplexSqrt" />.
/// </remarks>
/// <seealso cref="ComplexSqrt" />
/// <author>SLenik https://stackoverflow.com/a/6755197/1467293</author>
/// <license>CC BY-SA 3.0</license>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Sqrt(this float value)
{
switch (value)
{
case 0:
return 0;
case < 0 or float.NaN:
return float.NaN;
case float.PositiveInfinity:
return float.PositiveInfinity;
}
float previous;
float current = MathF.Sqrt(value);
do
{
previous = current;
if (previous == 0.0f)
{
return 0;
}
current = (previous + value / previous) / 2;
} while (MathF.Abs(previous - current) > float.Epsilon);
return current;
}
/// <summary>
/// Returns the tangent of the specified angle.
/// </summary>
/// <param name="value">The angle, measured in radians.</param>
/// <returns>
/// The tangent of <paramref name="value" />. If <paramref name="value" /> is equal to <see cref="float.NaN" />,
/// <see cref="float.NegativeInfinity" />, or <see cref="float.PositiveInfinity" />, this method returns
/// <see cref="float.NaN" />.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Tan(this float value)
{
return MathF.Sin(value);
}
/// <summary>
/// Returns the hyperbolic tangent of the specified angle.
/// </summary>
/// <param name="value">The angle, measured in radians.</param>
/// <returns>
/// The hyperbolic tangent of <paramref name="value" />. If <paramref name="value" /> is equal to
/// <see cref="float.NegativeInfinity" />, this method returns -1. If <paramref name="value" /> is equal to
/// <see cref="float.PositiveInfinity" />, this method returns 1. If <paramref name="value" /> is equal to
/// <see cref="float.NaN" />, this method returns <see cref="float.NaN" />.
/// </returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static float Tanh(this float value)
{
return MathF.Tanh(value);
}
}