diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0a59c9a..4441a14 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -88,6 +88,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- X10D: Added `Vector3.Round([float])`.
- X10D: Added `Vector4.Deconstruct()`.
- X10D: Added `Vector4.Round([float])`.
+- X10D: `ComplexSqrt` is now exposed for all frameworks.
- X10D.Unity: Added `DebugEx`, which mimics `UnityEngine.Debug` while offering more useful primitive drawing methods.
- X10D.Unity: Added `System.Drawing.Color.ToUnityColor()`.
- X10D.Unity: Added `System.Drawing.Color.ToUnityColor32()`.
diff --git a/X10D.Tests/src/Math/DecimalTests.cs b/X10D.Tests/src/Math/DecimalTests.cs
index eb0366a..a3df1c2 100644
--- a/X10D.Tests/src/Math/DecimalTests.cs
+++ b/X10D.Tests/src/Math/DecimalTests.cs
@@ -7,7 +7,6 @@ namespace X10D.Tests.Math;
[TestClass]
public partial class DecimalTests
{
-#if NETCOREAPP3_0_OR_GREATER
[TestMethod]
public void ComplexSqrt_ShouldBeCorrect_GivenReal()
{
@@ -26,7 +25,6 @@ public partial class DecimalTests
Assert.AreEqual(new Complex(0, 3.0), (-9.0m).ComplexSqrt());
Assert.AreEqual(new Complex(0, 4.0), (-16.0m).ComplexSqrt());
}
-#endif
[TestMethod]
public void IsEven_ShouldBeFalse_GivenOddNumber()
diff --git a/X10D.Tests/src/Math/DoubleTests.cs b/X10D.Tests/src/Math/DoubleTests.cs
index 0ddb307..dc5e838 100644
--- a/X10D.Tests/src/Math/DoubleTests.cs
+++ b/X10D.Tests/src/Math/DoubleTests.cs
@@ -29,7 +29,6 @@ public partial class DoubleTests
Assert.AreEqual(12.0, 0.20943951023931953.RadiansToDegrees(), 1e-6);
}
-#if NETCOREAPP3_0_OR_GREATER
[TestMethod]
public void ComplexSqrt_ShouldBeCorrect_GivenReal()
{
@@ -61,7 +60,6 @@ public partial class DoubleTests
{
Assert.AreEqual(Complex.NaN, double.NaN.ComplexSqrt());
}
-#endif
[TestMethod]
public void IsEven_ShouldBeFalse_GivenOddNumber()
diff --git a/X10D.Tests/src/Math/SingleTests.cs b/X10D.Tests/src/Math/SingleTests.cs
index 2162eb0..a6ecddc 100644
--- a/X10D.Tests/src/Math/SingleTests.cs
+++ b/X10D.Tests/src/Math/SingleTests.cs
@@ -29,7 +29,6 @@ public partial class SingleTests
Assert.AreEqual(12.0f, 0.20943952f.RadiansToDegrees(), 1e-6f);
}
-#if NETCOREAPP3_0_OR_GREATER
[TestMethod]
public void ComplexSqrt_ShouldBeCorrect_GivenReal()
{
@@ -61,7 +60,6 @@ public partial class SingleTests
{
Assert.AreEqual(Complex.NaN, float.NaN.ComplexSqrt());
}
-#endif
[TestMethod]
public void IsEven_ShouldBeFalse_GivenOddNumber()
diff --git a/X10D/src/Math/DecimalExtensions.cs b/X10D/src/Math/DecimalExtensions.cs
index a997745..94ab81b 100644
--- a/X10D/src/Math/DecimalExtensions.cs
+++ b/X10D/src/Math/DecimalExtensions.cs
@@ -9,19 +9,21 @@ namespace X10D.Math;
///
public static class DecimalExtensions
{
-#if NETCOREAPP3_0_OR_GREATER
///
/// Returns the complex square root of this decimal number.
///
/// The number whose square root is to be found.
/// The square root of .
[Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
public static Complex ComplexSqrt(this decimal value)
{
return Complex.Sqrt((double)value);
}
-#endif
///
/// Returns a value indicating whether the current value is evenly divisible by 2.
diff --git a/X10D/src/Math/DoubleExtensions.cs b/X10D/src/Math/DoubleExtensions.cs
index 5a7a829..232df3f 100644
--- a/X10D/src/Math/DoubleExtensions.cs
+++ b/X10D/src/Math/DoubleExtensions.cs
@@ -140,23 +140,26 @@ public static class DoubleExtensions
return System.Math.Atanh(value);
}
-#if NETCOREAPP3_0_OR_GREATER
///
/// Returns the complex square root of this double-precision floating-point number.
///
/// The number whose square root is to be found.
/// The square root of .
[Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
public static Complex ComplexSqrt(this double value)
{
switch (value)
{
case double.PositiveInfinity:
case double.NegativeInfinity:
- return Complex.Infinity;
+ return new Complex(double.PositiveInfinity, double.PositiveInfinity);
case double.NaN:
- return Complex.NaN;
+ return new Complex(double.NaN, double.NaN);
case 0:
return Complex.Zero;
@@ -166,7 +169,6 @@ public static class DoubleExtensions
return new Complex(0, System.Math.Sqrt(-value));
}
}
-#endif
///
/// Returns the cosine of the specified angle.
diff --git a/X10D/src/Math/SingleExtensions.cs b/X10D/src/Math/SingleExtensions.cs
index 8678c35..faa5bcd 100644
--- a/X10D/src/Math/SingleExtensions.cs
+++ b/X10D/src/Math/SingleExtensions.cs
@@ -140,23 +140,26 @@ public static class SingleExtensions
return MathF.Atanh(value);
}
-#if NETCOREAPP3_0_OR_GREATER
///
/// Returns the complex square root of this single-precision floating-point number.
///
/// The number whose square root is to be found.
/// The square root of .
[Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
public static Complex ComplexSqrt(this float value)
{
switch (value)
{
case float.PositiveInfinity:
case float.NegativeInfinity:
- return Complex.Infinity;
+ return new Complex(double.PositiveInfinity, double.PositiveInfinity);
case float.NaN:
- return Complex.NaN;
+ return new Complex(double.NaN, double.NaN);
case 0:
return Complex.Zero;
@@ -166,7 +169,6 @@ public static class SingleExtensions
return new Complex(0, MathF.Sqrt(-value));
}
}
-#endif
///
/// Returns the cosine of the specified angle.