Skip to content
Merged
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
38 changes: 18 additions & 20 deletions src/libraries/System.Private.CoreLib/src/System/Double.cs
Original file line number Diff line number Diff line change
Expand Up @@ -620,20 +620,20 @@ public static bool IsPow2(double value)
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp" />
public static double Exp(double x) => Math.Exp(x);

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.ExpM1(TSelf)" />
// public static double ExpM1(double x) => Math.ExpM1(x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.ExpM1(TSelf)" />
public static double ExpM1(double x) => Math.Exp(x) - 1;

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2(TSelf)" />
// public static double Exp2(double x) => Math.Exp2(x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2(TSelf)" />
public static double Exp2(double x) => Math.Pow(2, x);

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2M1(TSelf)" />
// public static double Exp2M1(double x) => Math.Exp2M1(x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2M1(TSelf)" />
public static double Exp2M1(double x) => Math.Pow(2, x) - 1;

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10(TSelf)" />
// public static double Exp10(double x) => Math.Exp10(x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10(TSelf)" />
public static double Exp10(double x) => Math.Pow(10, x);

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10M1(TSelf)" />
// public static double Exp10M1(double x) => Math.Exp10M1(x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10M1(TSelf)" />
public static double Exp10M1(double x) => Math.Pow(10, x) - 1;

//
// IFloatingPoint
Expand Down Expand Up @@ -911,17 +911,17 @@ public static double MinNumber(double x, double y)
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log(TSelf, TSelf)" />
public static double Log(double x, double newBase) => Math.Log(x, newBase);

/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10(TSelf)" />
public static double Log10(double x) => Math.Log10(x);
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.LogP1(TSelf)" />
public static double LogP1(double x) => Math.Log(x + 1);

// /// <inheritdoc cref="ILogarithmicFunctions{TSelf}.LogP1(TSelf)" />
// public static double LogP1(double x) => Math.LogP1(x);
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log2P1(TSelf)" />
public static double Log2P1(double x) => Math.Log2(x + 1);

// /// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log2P1(TSelf)" />
// public static double Log2P1(double x) => Math.Log2P1(x);
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10(TSelf)" />
public static double Log10(double x) => Math.Log10(x);

// /// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10P1(TSelf)" />
// public static double Log10P1(double x) => Math.Log10P1(x);
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10P1(TSelf)" />
public static double Log10P1(double x) => Math.Log10(x + 1);

//
// IMinMaxValue
Expand All @@ -940,8 +940,6 @@ public static double MinNumber(double x, double y)
/// <inheritdoc cref="IModulusOperators{TSelf, TOther, TResult}.op_Modulus(TSelf, TOther)" />
static double IModulusOperators<double, double, double>.operator %(double left, double right) => left % right;

// static checked double IModulusOperators<double, double, double>.operator %(double left, double right) => checked(left % right);

//
// IMultiplicativeIdentity
//
Expand Down
32 changes: 16 additions & 16 deletions src/libraries/System.Private.CoreLib/src/System/Half.cs
Original file line number Diff line number Diff line change
Expand Up @@ -841,20 +841,20 @@ public static bool IsPow2(Half value)
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp" />
public static Half Exp(Half x) => (Half)MathF.Exp((float)x);

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.ExpM1(TSelf)" />
// public static Half ExpM1(Half x) => (Half)MathF.ExpM1((float)x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.ExpM1(TSelf)" />
public static Half ExpM1(Half x) => (Half)float.ExpM1((float)x);

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2(TSelf)" />
// public static Half Exp2(Half x) => (Half)MathF.Exp2((float)x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2(TSelf)" />
public static Half Exp2(Half x) => (Half)float.Exp2((float)x);

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2M1(TSelf)" />
// public static Half Exp2M1(Half x) => (Half)MathF.Exp2M1((float)x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2M1(TSelf)" />
public static Half Exp2M1(Half x) => (Half)float.Exp2M1((float)x);

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10(TSelf)" />
// public static Half Exp10(Half x) => (Half)MathF.Exp10((float)x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10(TSelf)" />
public static Half Exp10(Half x) => (Half)float.Exp10((float)x);

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10M1(TSelf)" />
// public static Half Exp10M1(Half x) => (Half)MathF.Exp10M1((float)x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10M1(TSelf)" />
public static Half Exp10M1(Half x) => (Half)float.Exp10M1((float)x);

//
// IFloatingPoint
Expand Down Expand Up @@ -1128,14 +1128,14 @@ public static Half MinNumber(Half x, Half y)
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10(TSelf)" />
public static Half Log10(Half x) => (Half)MathF.Log10((float)x);

// /// <inheritdoc cref="ILogarithmicFunctions{TSelf}.LogP1(TSelf)" />
// public static Half LogP1(Half x) => (Half)MathF.LogP1((float)x);
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.LogP1(TSelf)" />
public static Half LogP1(Half x) => (Half)float.LogP1((float)x);

// /// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log2P1(TSelf)" />
// public static Half Log2P1(Half x) => (Half)MathF.Log2P1((float)x);
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log2P1(TSelf)" />
public static Half Log2P1(Half x) => (Half)float.Log2P1((float)x);

// /// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10P1(TSelf)" />
// public static Half Log10P1(Half x) => (Half)MathF.Log10P1((float)x);
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10P1(TSelf)" />
public static Half Log10P1(Half x) => (Half)float.Log10P1((float)x);

//
// IModulusOperators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,32 @@ public interface IExponentialFunctions<TSelf>
{
/// <summary>Computes <c>E</c> raised to a given power.</summary>
/// <param name="x">The power to which <c>E</c> is raised.</param>
/// <returns><c>E</c> raised to the power of <paramref name="x" />.</returns>
/// <returns><c>E<sup><paramref name="x" /></sup></c></returns>
static abstract TSelf Exp(TSelf x);

// The following methods are approved but not yet implemented in the libraries
// * static abstract TSelf ExpM1(TSelf x);
// * static abstract TSelf Exp2(TSelf x);
// * static abstract TSelf Exp2M1(TSelf x);
// * static abstract TSelf Exp10(TSelf x);
// * static abstract TSelf Exp10M1(TSelf x);
/// <summary>Computes <c>E</c> raised to a given power and subtracts one.</summary>
/// <param name="x">The power to which <c>E</c> is raised.</param>
/// <returns><c>E<sup><paramref name="x" /></sup> - 1</c></returns>
static abstract TSelf ExpM1(TSelf x);

/// <summary>Computes <c>2</c> raised to a given power.</summary>
/// <param name="x">The power to which <c>2</c> is raised.</param>
/// <returns><c>2<sup><paramref name="x" /></sup></c></returns>
static abstract TSelf Exp2(TSelf x);

/// <summary>Computes <c>2</c> raised to a given power and subtracts one.</summary>
/// <param name="x">The power to which <c>2</c> is raised.</param>
/// <returns><c>2<sup><paramref name="x" /></sup> - 1</c></returns>
static abstract TSelf Exp2M1(TSelf x);

/// <summary>Computes <c>10</c> raised to a given power.</summary>
/// <param name="x">The power to which <c>10</c> is raised.</param>
/// <returns><c>10<sup><paramref name="x" /></sup></c></returns>
static abstract TSelf Exp10(TSelf x);

/// <summary>Computes <c>10</c> raised to a given power and subtracts one.</summary>
/// <param name="x">The power to which <c>10</c> is raised.</param>
/// <returns><c>10<sup><paramref name="x" /></sup> - 1</c></returns>
static abstract TSelf Exp10M1(TSelf x);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,40 @@ namespace System.Numerics
public interface ILogarithmicFunctions<TSelf>
where TSelf : ILogarithmicFunctions<TSelf>
{
/// <summary>Computes the natural (<c>base-E</c> logarithm of a value.</summary>
/// <summary>Computes the natural (<c>base-E</c>) logarithm of a value.</summary>
/// <param name="x">The value whose natural logarithm is to be computed.</param>
/// <returns>The natural logarithm of <paramref name="x" />.</returns>
/// <returns><c>log<sub>e</sub>(<paramref name="x" />)</c></returns>
static abstract TSelf Log(TSelf x);

/// <summary>Computes the logarithm of a value in the specified base.</summary>
/// <param name="x">The value whose logarithm is to be computed.</param>
/// <param name="newBase">The base in which the logarithm is to be computed.</param>
/// <returns>The base-<paramref name="newBase" /> logarithm of <paramref name="x" />.</returns>
/// <returns><c>log<sub><paramref name="newBase" /></sub>(<paramref name="x" />)</c></returns>
static abstract TSelf Log(TSelf x, TSelf newBase);

/// <summary>Computes the natural (<c>base-E</c>) logarithm of a value plus one.</summary>
/// <param name="x">The value to which one is added before computing the natural logarithm.</param>
/// <returns><c>log<sub>e</sub>(<paramref name="x" /> + 1)</c></returns>
static abstract TSelf LogP1(TSelf x);

/// <summary>Computes the base-2 logarithm of a value.</summary>
/// <param name="x">The value whose base-2 logarithm is to be computed.</param>
/// <returns>The base-2 logarithm of <paramref name="x" />.</returns>
/// <returns><c>log<sub>2</sub>(<paramref name="x" />)</c></returns>
static abstract TSelf Log2(TSelf x);

/// <summary>Computes the base-2 logarithm of a value plus one.</summary>
/// <param name="x">The value to which one is added before computing the base-2 logarithm.</param>
/// <returns><c>log<sub>2</sub>(<paramref name="x" /> + 1)</c></returns>
static abstract TSelf Log2P1(TSelf x);

/// <summary>Computes the base-10 logarithm of a value.</summary>
/// <param name="x">The value whose base-10 logarithm is to be computed.</param>
/// <returns>The base-10 logarithm of <paramref name="x" />.</returns>
/// <returns><c>log<sub>10</sub>(<paramref name="x" />)</c></returns>
static abstract TSelf Log10(TSelf x);

// The following methods are approved but not yet implemented in the libraries
// * static abstract TSelf LogP1(TSelf x);
// * static abstract TSelf Log2P1(TSelf x);
// * static abstract TSelf Log10P1(TSelf x);
/// <summary>Computes the base-10 logarithm of a value plus one.</summary>
/// <param name="x">The value to which one is added before computing the base-10 logarithm.</param>
/// <returns><c>log<sub>10</sub>(<paramref name="x" /> + 1)</c></returns>
static abstract TSelf Log10P1(TSelf x);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -820,20 +820,20 @@ public int CompareTo(object? obj)
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp" />
public static NFloat Exp(NFloat x) => new NFloat(NativeType.Exp(x._value));

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.ExpM1(TSelf)" />
// public static NFloat ExpM1(NFloat x) => new NFloat(NativeType.ExpM1(x._value));
/// <inheritdoc cref="IExponentialFunctions{TSelf}.ExpM1(TSelf)" />
public static NFloat ExpM1(NFloat x) => new NFloat(NativeType.ExpM1(x._value));

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2(TSelf)" />
// public static NFloat Exp2(NFloat x) => new NFloat(NativeType.Exp2(x._value));
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2(TSelf)" />
public static NFloat Exp2(NFloat x) => new NFloat(NativeType.Exp2(x._value));

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2M1(TSelf)" />
// public static NFloat Exp2M1(NFloat x) => new NFloat(NativeType.Exp2M1(x._value));
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2M1(TSelf)" />
public static NFloat Exp2M1(NFloat x) => new NFloat(NativeType.Exp2M1(x._value));

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10(TSelf)" />
// public static NFloat Exp10(NFloat x) => new NFloat(NativeType.Exp10(x._value))(x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10(TSelf)" />
public static NFloat Exp10(NFloat x) => new NFloat(NativeType.Exp10(x._value));

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10M1(TSelf)" />
// public static NFloat Exp10M1(NFloat x) => new NFloat(NativeType.Exp10M1(x._value));
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10M1(TSelf)" />
public static NFloat Exp10M1(NFloat x) => new NFloat(NativeType.Exp10M1(x._value));

//
// IFloatingPoint
Expand Down Expand Up @@ -1021,17 +1021,17 @@ bool IFloatingPoint<NFloat>.TryWriteSignificandLittleEndian(Span<byte> destinati
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log(TSelf, TSelf)" />
public static NFloat Log(NFloat x, NFloat newBase) => new NFloat(NativeType.Log(x._value, newBase._value));

/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10(TSelf)" />
public static NFloat Log10(NFloat x) => new NFloat(NativeType.Log10(x._value));
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.LogP1(TSelf)" />
public static NFloat LogP1(NFloat x) => new NFloat(NativeType.LogP1(x._value));

// /// <inheritdoc cref="ILogarithmicFunctions{TSelf}.LogP1(TSelf)" />
// public static NFloat LogP1(NFloat x) => new NFloat(NativeType.LogP1(x._value));
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log2P1(TSelf)" />
public static NFloat Log2P1(NFloat x) => new NFloat(NativeType.Log2P1(x._value));

// /// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log2P1(TSelf)" />
// public static NFloat Log2P1(NFloat x) => new NFloat(NativeType.Log2P1(x._value));
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10(TSelf)" />
public static NFloat Log10(NFloat x) => new NFloat(NativeType.Log10(x._value));

// /// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10P1(TSelf)" />
// public static NFloat Log10P1(NFloat x) => new NFloat(NativeType.Log10P1(x._value));
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10P1(TSelf)" />
public static NFloat Log10P1(NFloat x) => new NFloat(NativeType.Log10P1(x._value));

//
// IMultiplicativeIdentity
Expand Down
36 changes: 17 additions & 19 deletions src/libraries/System.Private.CoreLib/src/System/Single.cs
Original file line number Diff line number Diff line change
Expand Up @@ -615,20 +615,20 @@ public static bool IsPow2(float value)
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp" />
public static float Exp(float x) => MathF.Exp(x);

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.ExpM1(TSelf)" />
// public static float ExpM1(float x) => MathF.ExpM1(x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.ExpM1(TSelf)" />
public static float ExpM1(float x) => MathF.Exp(x) - 1;

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2(TSelf)" />
// public static float Exp2(float x) => MathF.Exp2(x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2(TSelf)" />
public static float Exp2(float x) => MathF.Pow(2, x);

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2M1(TSelf)" />
// public static float Exp2M1(float x) => MathF.Exp2M1(x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp2M1(TSelf)" />
public static float Exp2M1(float x) => MathF.Pow(2, x) - 1;

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10(TSelf)" />
// public static float Exp10(float x) => MathF.Exp10(x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10(TSelf)" />
public static float Exp10(float x) => MathF.Pow(10, x);

// /// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10M1(TSelf)" />
// public static float Exp10M1(float x) => MathF.Exp10M1(x);
/// <inheritdoc cref="IExponentialFunctions{TSelf}.Exp10M1(TSelf)" />
public static float Exp10M1(float x) => MathF.Pow(10, x) - 1;

//
// IFloatingPoint
Expand Down Expand Up @@ -906,17 +906,17 @@ public static float MinNumber(float x, float y)
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log(TSelf, TSelf)" />
public static float Log(float x, float newBase) => MathF.Log(x, newBase);

/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.LogP1(TSelf)" />
public static float LogP1(float x) => MathF.Log(x + 1);

/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10(TSelf)" />
public static float Log10(float x) => MathF.Log10(x);

// /// <inheritdoc cref="ILogarithmicFunctions{TSelf}.LogP1(TSelf)" />
// public static float LogP1(float x) => MathF.LogP1(x);

// /// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log2P1(TSelf)" />
// public static float Log2P1(float x) => MathF.Log2P1(x);
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log2P1(TSelf)" />
public static float Log2P1(float x) => MathF.Log2(x + 1);

// /// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10P1(TSelf)" />
// public static float Log10P1(float x) => MathF.Log10P1(x);
/// <inheritdoc cref="ILogarithmicFunctions{TSelf}.Log10P1(TSelf)" />
public static float Log10P1(float x) => MathF.Log10(x + 1);

//
// IMinMaxValue
Expand All @@ -935,8 +935,6 @@ public static float MinNumber(float x, float y)
/// <inheritdoc cref="IModulusOperators{TSelf, TOther, TResult}.op_Modulus(TSelf, TOther)" />
static float IModulusOperators<float, float, float>.operator %(float left, float right) => left % right;

// static checked float IModulusOperators<float, float, float>.operator %(float left, float right) => checked(left % right);

//
// IMultiplicativeIdentity
//
Expand Down
Loading