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
20 changes: 20 additions & 0 deletions PolyShim.Tests/NetCore30/MathTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using FluentAssertions;
using Xunit;

namespace PolyShim.Tests.NetCore30;

public class MathTests
{
[Fact]
public void Log2_Test()
{
// Act & assert
Math.Log2(8.0).Should().BeApproximately(3.0, 1e-12);
Math.Log2(1.0).Should().Be(0.0);
Comment thread
Copilot marked this conversation as resolved.
Math.Log2(0.0).Should().Be(double.NegativeInfinity);
Math.Log2(double.PositiveInfinity).Should().Be(double.PositiveInfinity);
Math.Log2(-1.0).Should().Be(double.NaN);
Math.Log2(double.NaN).Should().Be(double.NaN);
}
}
19 changes: 19 additions & 0 deletions PolyShim/NetCore30/Math.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#if (NETCOREAPP && !NETCOREAPP3_0_OR_GREATER) || (NETFRAMEWORK) || (NETSTANDARD)
#nullable enable
#pragma warning disable CS0436

using System;
using System.Diagnostics.CodeAnalysis;

#if !POLYSHIM_INCLUDE_COVERAGE
[ExcludeFromCodeCoverage]
#endif
internal static class MemberPolyfills_NetCore30_Math
{
extension(Math)
{
// https://learn.microsoft.com/dotnet/api/system.math.log2
public static double Log2(double x) => Math.Log(x, 2);
Comment thread
Tyrrrz marked this conversation as resolved.
}
}
#endif
5 changes: 3 additions & 2 deletions Signatures.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Signatures

- **Total:** 620
- **Total:** 621
- **Types:** 114
- **Members:** 506
- **Members:** 507

___

Expand Down Expand Up @@ -396,6 +396,7 @@ ___
- [`IEnumerator<Match> GetEnumerator()`](https://learn.microsoft.com/dotnet/api/system.text.regularexpressions.matchcollection.system-collections-generic-ienumerable-system-text-regularexpressions-match--getenumerator) <sup><sub>.NET Core 2.0</sub></sup>
- [`Match[] ToArray()`](https://learn.microsoft.com/dotnet/api/system.text.regularexpressions.matchcollection.system-collections-generic-ienumerable-system-text-regularexpressions-match--getenumerator) <sup><sub>.NET Core 2.0</sub></sup>
- `Math`
- [`static double Log2(double)`](https://learn.microsoft.com/dotnet/api/system.math.log2) <sup><sub>.NET Core 3.0</sub></sup>
- [`static IntPtr Clamp(IntPtr, IntPtr, IntPtr)`](https://learn.microsoft.com/dotnet/api/system.math.clamp#system-math-clamp(system-intptr-system-intptr-system-intptr)) <sup><sub>.NET 6.0</sub></sup>
- [`static T Clamp<T>(T, T, T) where T : IComparable<T>`](https://learn.microsoft.com/dotnet/api/system.math.clamp) <sup><sub>.NET Core 2.0</sub></sup>
- `MaybeNullAttribute`
Expand Down
Loading