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
14 changes: 14 additions & 0 deletions QuadrupleLib.Tests/Math/LogarithmTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ namespace QuadrupleLib.Tests.Math
public abstract class LogarithmTests<TAccelerator>
where TAccelerator : IAccelerator
{
[Theory]
[InlineData(-0.288)]
[InlineData(0.5)]
[InlineData(2.0)]
[InlineData(-2.0)]
[InlineData(-4.65)]
public void IsILogBCorrect(double x)
{
double y = double.Exp2(x);

int n = (int)System.Math.Floor(x);
Assert.Equal(n, Float128<TAccelerator>.ILogB(y));
}

[Theory]
[InlineData(-0.288)]
[InlineData(0.5)]
Expand Down
11 changes: 11 additions & 0 deletions QuadrupleLib.Tests/Math/TrigonometryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,17 @@ public void IsAtan2EqualCoRDiC(double thetaDeg)
Float128<TAccelerator> thetaB = Float128<TAccelerator>.Atan2(sin, cos);
AssertX.NearlyEqual(thetaA, thetaB, Precision.NearestTenThousandth);
}

[Theory]
[InlineData(3.0, 4.0)]
[InlineData(1.5, 2.0)]
[InlineData(1.0, 1.0)]
[InlineData(5.6, 7.125)]
public void IsHypotCorrect(double a, double b)
{
double c = double.Hypot(a, b);
AssertX.NearlyEqual(c, Float128<TAccelerator>.Hypot(a, b), Precision.NearestTenThousandth);
}
}

public class TrigonometryTests_DefaultAccelerator :
Expand Down
20 changes: 19 additions & 1 deletion QuadrupleLib.Tests/Utilities/AcceleratorTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
using QuadrupleLib.Accelerators;
/*
* Copyright 2026 Chosen Few Software
* This file is part of QuadrupleLib.
*
* QuadrupleLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QuadrupleLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with QuadrupleLib. If not, see <https://www.gnu.org/licenses/>.
*/

using QuadrupleLib.Accelerators;
using Xunit;

namespace QuadrupleLib.Tests.Utilities
Expand Down
Loading