Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back Abs(float) #66

Merged
merged 1 commit into from
May 20, 2021
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
28 changes: 18 additions & 10 deletions nanoFramework.System.Math/Math.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ public static class Math
/// <remarks>The value of this field is 2.7182818284590452354.</remarks>
public const double E = 2.7182818284590452354;

/// <summary>
/// Returns the absolute value of a 32-bit signed integer.
/// </summary>
/// <param name="val">A number that is greater than Int32..::..MinValue, but less than or equal to Int32..::..MaxValue.</param>
/// <returns>A 32-bit signed integer, x, such that 0 ≤ x ≤ Int32..::..MaxValue.</returns>
public static int Abs(int val)
{
return MathInternal.Abs(val);
}

/// <summary>
/// Returns the larger of two 32-bit signed integers.
/// </summary>
Expand All @@ -56,6 +46,16 @@ public static int Min(int val1, int val2)
return MathInternal.Min(val1, val2);
}

/// <summary>
/// Returns the absolute value of a 32-bit signed integer.
/// </summary>
/// <param name="val">A number that is greater than Int32..::..MinValue, but less than or equal to Int32..::..MaxValue.</param>
/// <returns>A 32-bit signed integer, x, such that 0 ≤ x ≤ Int32..::..MaxValue.</returns>
public static int Abs(int val)
{
return MathInternal.Abs(val);
}

/// <summary>
/// Returns the absolute value of a double-precision floating-point number.
/// </summary>
Expand All @@ -68,6 +68,14 @@ public static int Min(int val1, int val2)
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Abs(double val);

/// <summary>
/// Returns the absolute value of a single-precision floating-point number.
/// </summary>
/// <param name="val">A number that is greater than or equal to MinValue, but less than or equal to MaxValue.</param>
/// <returns>A single-precision floating-point number, x, such that 0 ≤ x ≤ MaxValue.</returns>
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Abs(float val);

/// <summary>
/// Returns the angle whose cosine is the specified number.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion nanoFramework.System.Math/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@

////////////////////////////////////////////////////////////////
// update this whenever the native assembly signature changes //
[assembly: AssemblyNativeVersion("100.0.5.0")]
[assembly: AssemblyNativeVersion("100.0.5.1")]
////////////////////////////////////////////////////////////////