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
1 change: 1 addition & 0 deletions QuadrupleLib.Tests/Assertions/Types/Precision.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ internal enum Precision
NearestTenth = 1,
NearestHundreth = 2,
NearestThousandth = 3,
NearestTenThousandth = 4,
}
6 changes: 3 additions & 3 deletions QuadrupleLib.Tests/Math/ExponentialTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public abstract class ExponentialTests<TAccelerator>
public void IsExpCorrect(double x)
{
double y = double.Exp(x);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Exp(x), Precision.NearestThousandth);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Exp(x), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -48,7 +48,7 @@ public void IsExpCorrect(double x)
public void IsExp2Correct(double x)
{
double y = double.Exp2(x);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Exp2(x), Precision.NearestThousandth);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Exp2(x), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -61,7 +61,7 @@ public void IsExp2Correct(double x)
public void IsExp10Correct(double x)
{
double y = double.Exp10(x);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Exp10(x), Precision.NearestThousandth);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Exp10(x), Precision.NearestTenThousandth);
}
}

Expand Down
12 changes: 6 additions & 6 deletions QuadrupleLib.Tests/Math/HyperbolicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public abstract class HyperbolicTests<TAccelerator>
public void IsSinhCorrect(double x)
{
double y = double.Sinh(x);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Sinh(x), Precision.NearestThousandth);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Sinh(x), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -46,7 +46,7 @@ public void IsSinhCorrect(double x)
public void IsCoshCorrect(double x)
{
double y = double.Cosh(x);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Cosh(x), Precision.NearestThousandth);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Cosh(x), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -58,7 +58,7 @@ public void IsCoshCorrect(double x)
public void IsTanhCorrect(double x)
{
double y = double.Tanh(x);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Tanh(x), Precision.NearestThousandth);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Tanh(x), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -70,7 +70,7 @@ public void IsTanhCorrect(double x)
public void IsInverseSinhCorrect(double x)
{
double y = double.Asinh(x);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Asinh(x), Precision.NearestThousandth);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Asinh(x), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -80,7 +80,7 @@ public void IsInverseSinhCorrect(double x)
public void IsInverseCoshCorrect(double x)
{
double y = double.Acosh(x);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Acosh(x), Precision.NearestThousandth);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Acosh(x), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -98,7 +98,7 @@ public void IsInverseCoshNaN(double x)
public void IsInverseTanhCorrect(double x)
{
double y = double.Atanh(x);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Atanh(x), Precision.NearestThousandth);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Atanh(x), Precision.NearestTenThousandth);
}

[Theory]
Expand Down
8 changes: 4 additions & 4 deletions QuadrupleLib.Tests/Math/LogarithmTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public abstract class LogarithmTests<TAccelerator>
public void IsLogCorrect(double x)
{
double y = double.Exp(x);
AssertX.NearlyEqual(x, Float128<TAccelerator>.Log(y), Precision.NearestThousandth);
AssertX.NearlyEqual(x, Float128<TAccelerator>.Log(y), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -55,7 +55,7 @@ public void IsLogNaN(double x)
public void IsLog2Correct(double x)
{
double y = double.Exp2(x);
AssertX.NearlyEqual(x, Float128<TAccelerator>.Log2(y), Precision.NearestThousandth);
AssertX.NearlyEqual(x, Float128<TAccelerator>.Log2(y), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -76,7 +76,7 @@ public void IsLog2NaN(double x)
public void IsLog10Correct(double x)
{
double y = double.Exp10(x);
AssertX.NearlyEqual(x, Float128<TAccelerator>.Log10(y), Precision.NearestThousandth);
AssertX.NearlyEqual(x, Float128<TAccelerator>.Log10(y), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -102,7 +102,7 @@ public void IsLog10NaN(double x)
public void IsLogBCorrect(double x, double b)
{
double y = double.Pow(b, x);
AssertX.NearlyEqual(x, Float128<TAccelerator>.Log(y, b), Precision.NearestThousandth);
AssertX.NearlyEqual(x, Float128<TAccelerator>.Log(y, b), Precision.NearestTenThousandth);
}

[Theory]
Expand Down
16 changes: 8 additions & 8 deletions QuadrupleLib.Tests/Math/PowerAndRootTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract class PowerAndRootTests<TAccelerator>
public void IsSqrtCorrect(double x)
{
double y = double.Sqrt(x);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Sqrt(x), Precision.NearestThousandth);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Sqrt(x), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -42,7 +42,7 @@ public void IsSqrtCorrect(double x)
public void IsCbrtCorrect(double x)
{
double y = double.Cbrt(x);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Cbrt(x), Precision.NearestThousandth);
AssertX.NearlyEqual(y, Float128<TAccelerator>.Cbrt(x), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -58,7 +58,7 @@ public void IsCbrtCorrect(double x)
public void IsRootNCorrect(double x, int n)
{
double y = double.RootN(x, n);
AssertX.NearlyEqual(y, Float128<TAccelerator>.RootN(x, n), Precision.NearestThousandth);
AssertX.NearlyEqual(y, Float128<TAccelerator>.RootN(x, n), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -75,7 +75,7 @@ public void IsRootNEqualToPow(double x, int n)
{
Float128<TAccelerator> y0 = Float128<TAccelerator>.RootN(x, n);
Float128<TAccelerator> y1 = Float128<TAccelerator>.Pow(x, Float128<TAccelerator>.One / n);
AssertX.NearlyEqual(y0, y1, Precision.NearestThousandth);
AssertX.NearlyEqual(y0, y1, Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -94,7 +94,7 @@ public void IsRootNEqualToPow(double x, int n)
public void IsPowCorrect(double x, double y)
{
double z = double.Pow(x, y);
AssertX.NearlyEqual(z, Float128<TAccelerator>.Pow(x, y), Precision.NearestThousandth);
AssertX.NearlyEqual(z, Float128<TAccelerator>.Pow(x, y), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -103,7 +103,7 @@ public void IsPowCorrect(double x, double y)
[InlineData(3.676)]
public void IsPowZeroEqualToOne(double x)
{
AssertX.NearlyEqual(Float128<TAccelerator>.One, Float128<TAccelerator>.Pow(x, 0), Precision.NearestThousandth);
AssertX.NearlyEqual(Float128<TAccelerator>.One, Float128<TAccelerator>.Pow(x, 0), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -122,7 +122,7 @@ public void IsPowZeroEqualToNaN(double x)
[InlineData(3.676)]
public void IsPowOneIdentity(double x)
{
AssertX.NearlyEqual(x, Float128<TAccelerator>.Pow(x, Float128<TAccelerator>.One), Precision.NearestThousandth);
AssertX.NearlyEqual(x, Float128<TAccelerator>.Pow(x, Float128<TAccelerator>.One), Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -131,7 +131,7 @@ public void IsPowOneIdentity(double x)
[InlineData(3.676)]
public void IsPowNegativeOneReciprocal(double x)
{
AssertX.NearlyEqual(Float128<TAccelerator>.One / x, Float128<TAccelerator>.Pow(x, Float128<TAccelerator>.NegativeOne), Precision.NearestThousandth);
AssertX.NearlyEqual(Float128<TAccelerator>.One / x, Float128<TAccelerator>.Pow(x, Float128<TAccelerator>.NegativeOne), Precision.NearestTenThousandth);
}
}

Expand Down
14 changes: 7 additions & 7 deletions QuadrupleLib.Tests/Math/TrigonometryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public void IsInverseCosEqualCoRDiC(double thetaDeg)
Float128<TAccelerator> thetaA = thetaDeg * Float128<TAccelerator>.Pi / 180;
Float128<TAccelerator> cos = Float128<TAccelerator>.Cos(thetaA);
Float128<TAccelerator> thetaB = Float128<TAccelerator>.Acos(cos);
AssertX.NearlyEqual(thetaA, thetaB, Precision.NearestThousandth);
AssertX.NearlyEqual(thetaA, thetaB, Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -318,7 +318,7 @@ public void IsInverseSinEqualCoRDiC(double thetaDeg)
Float128<TAccelerator> thetaA = thetaDeg * Float128<TAccelerator>.Pi / 180;
Float128<TAccelerator> sin = Float128<TAccelerator>.Sin(thetaA);
Float128<TAccelerator> thetaB = Float128<TAccelerator>.Asin(sin);
AssertX.NearlyEqual(thetaA, thetaB, Precision.NearestThousandth);
AssertX.NearlyEqual(thetaA, thetaB, Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -334,7 +334,7 @@ public void IsInverseTanEqualCoRDiC(double thetaDeg)
Float128<TAccelerator> thetaA = thetaDeg * Float128<TAccelerator>.Pi / 180;
Float128<TAccelerator> tan = Float128<TAccelerator>.Tan(thetaA);
Float128<TAccelerator> thetaB = Float128<TAccelerator>.Atan(tan);
AssertX.NearlyEqual(thetaA, thetaB, Precision.NearestThousandth);
AssertX.NearlyEqual(thetaA, thetaB, Precision.NearestTenThousandth);
}

[Theory]
Expand Down Expand Up @@ -582,7 +582,7 @@ public void IsInverseCosPiEqualCoRDiC(double thetaDeg)
Float128<TAccelerator> thetaA = thetaDeg * Float128<TAccelerator>.Pi / 180;
Float128<TAccelerator> cos = Float128<TAccelerator>.Cos(thetaA);
Float128<TAccelerator> thetaB = Float128<TAccelerator>.AcosPi(cos);
AssertX.NearlyEqual(thetaA, thetaB * Float128<TAccelerator>.Pi, Precision.NearestThousandth);
AssertX.NearlyEqual(thetaA, thetaB * Float128<TAccelerator>.Pi, Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -601,7 +601,7 @@ public void IsInverseSinPiEqualCoRDiC(double thetaDeg)
Float128<TAccelerator> thetaA = thetaDeg * Float128<TAccelerator>.Pi / 180;
Float128<TAccelerator> sin = Float128<TAccelerator>.Sin(thetaA);
Float128<TAccelerator> thetaB = Float128<TAccelerator>.AsinPi(sin);
AssertX.NearlyEqual(thetaA, thetaB * Float128<TAccelerator>.Pi, Precision.NearestThousandth);
AssertX.NearlyEqual(thetaA, thetaB * Float128<TAccelerator>.Pi, Precision.NearestTenThousandth);
}

[Theory]
Expand All @@ -617,7 +617,7 @@ public void IsInverseTanPiEqualCoRDiC(double thetaDeg)
Float128<TAccelerator> thetaA = thetaDeg / 180;
Float128<TAccelerator> tan = Float128<TAccelerator>.TanPi(thetaA);
Float128<TAccelerator> thetaB = Float128<TAccelerator>.AtanPi(tan);
AssertX.NearlyEqual(thetaA, thetaB, Precision.NearestThousandth);
AssertX.NearlyEqual(thetaA, thetaB, Precision.NearestTenThousandth);
}

[Theory]
Expand Down Expand Up @@ -691,7 +691,7 @@ public void IsAtan2EqualCoRDiC(double thetaDeg)
Float128<TAccelerator> thetaA = thetaDeg * Float128<TAccelerator>.Pi / 180;
(Float128<TAccelerator> sin, Float128<TAccelerator> cos) = Float128<TAccelerator>.SinCos(thetaA);
Float128<TAccelerator> thetaB = Float128<TAccelerator>.Atan2(sin, cos);
AssertX.NearlyEqual(thetaA, thetaB, Precision.NearestThousandth);
AssertX.NearlyEqual(thetaA, thetaB, Precision.NearestTenThousandth);
}
}

Expand Down
2 changes: 1 addition & 1 deletion QuadrupleLib/Modules/MathOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public partial struct Float128<TAccelerator>
{
#region Public API (trig functions)

private const int SINCOS_ITER_COUNT = 32;
private const int SINCOS_ITER_COUNT = 48;

private static readonly Float128<TAccelerator>[] _thetaTable;

Expand Down
Loading