Skip to content

Commit

Permalink
Using Math.Pow is changed to use * for optimization propouse (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonovAnton authored Jun 19, 2024
1 parent bbee52f commit a209ee0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions MathTrigonometric/MathTrig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,9 @@ public static double Asinh(double x)

//the Trigonometric Symmetry is applied: arsinh(−x)=−arsinh(x)
if (IsNegative(x))
return -Math.Log(-x + Math.Sqrt(Math.Pow(x, 2.0) + 1.0));
return -Math.Log(-x + Math.Sqrt(x * x + 1.0));

return Math.Log(x + Math.Sqrt(Math.Pow(x, 2.0) + 1.0));
return Math.Log(x + Math.Sqrt(x * x + 1.0));
}

/// <summary>
Expand All @@ -381,7 +381,7 @@ public static double Acosh(double x)
if (x < 1.0)
return double.NaN;

return Math.Log(x + Math.Sqrt(Math.Pow(x, 2.0) - 1.0));
return Math.Log(x + Math.Sqrt(x * x - 1.0));
}

/// <summary>
Expand Down Expand Up @@ -430,9 +430,9 @@ public static double Acsch(double x)

//the Trigonometric Symmetry is applied: arcsch(−x)=−arcsch(x)
if (IsNegative(x))
return -Math.Log(1.0 / -x + Math.Sqrt(1.0 / Math.Pow(x, 2.0) + 1.0));
return -Math.Log(1.0 / -x + Math.Sqrt(1.0 / (x * x) + 1.0));

return Math.Log(1.0 / x + Math.Sqrt(1.0 / Math.Pow(x, 2.0) + 1.0));
return Math.Log(1.0 / x + Math.Sqrt(1.0 / (x * x) + 1.0));
}

/// <summary>
Expand All @@ -451,7 +451,7 @@ public static double Asech(double x)
if (x is <= 0.0 or > 1.0)
return double.NaN;

return Math.Log(1.0 / x + Math.Sqrt(1.0 / Math.Pow(x, 2.0) - 1.0));
return Math.Log(1.0 / x + Math.Sqrt(1.0 / (x * x) - 1.0));
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion MathTrigonometric/MathTrigonometric.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageTags>math; trigonometric; trigonometry; cot; sec; csc; acot; asec; acsc; coth; sech; csch; acoth; asech; acsch;</PackageTags>
<PackageReleaseNotes>It targets .NET Standard 2.0 and higner version.</PackageReleaseNotes>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Version>1.0.6</Version>
<Version>1.0.7</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down

0 comments on commit a209ee0

Please sign in to comment.