feat(math): Math.OneOver and Invert methods added

This commit is contained in:
2026-04-04 18:50:47 +03:00
parent af2eed2200
commit 7fb6821a83
2 changed files with 16 additions and 0 deletions

View File

@@ -30,6 +30,16 @@ public static class Math
/// </summary>
public const float DegreeToRadian = Pi / 180f;
/// <inheritdoc cref="Invert{T}(T)" />
public static T OneOver<T>(T value) where T : INumber<T> => T.One / value;
/// <summary>
/// Gets 1 / value of given <see cref="T"/>.
/// </summary>
/// <param name="value">The value <see cref="T"/>.</param>
/// <returns>1 / value of given <see cref="T"/>.</returns>
public static T Invert<T>(T value) where T : INumber<T> => T.One / value;
/// <summary>
/// Gets one minus of given <see cref="T"/>.
/// </summary>

View File

@@ -8,6 +8,12 @@ public static class MathExtensions
/// <inheritdoc cref="Math.OneMinus{T}(T)" />
public static T OneMinus<T>(this T value) where T : INumber<T> => Math.OneMinus(value);
/// <inheritdoc cref="Math.OneOver{T}(T)" />
public static T OneOver<T>(this T value) where T : INumber<T> => Math.OneOver(value);
/// <inheritdoc cref="Math.Invert{T}(T)" />
public static T Invert<T>(this T value) where T : INumber<T> => Math.OneMinus(value);
/// <inheritdoc cref="Math.Add{T}(T, T)" />
public static T Add<T>(this T left, T value) where T : INumber<T> => Math.Add(left, value);