You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+64-3Lines changed: 64 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
6
6
QuadrupleLib is a modern implementation of the IEEE 754 `binary128` floating point number type for .NET 8 and above based on the `UInt128` built-in. The goal of this project is to create a fully fleshed out 128-bit floating point arithmetic library that includes all of the bells and whistles one could possibly want.
7
7
8
-
### Project TODOs (Completed)
8
+
#Main Features
9
9
10
10
-[x] Adheres to recommended requirements of IEEE 754 specification
-[x] Unit tests to check for specification coverage
20
+
-[x] Unit tests to check for specification coverage & overall correctness
21
+
22
+
# Using QuadrupleLib
23
+
24
+
QuadrupleLib is available as a regularly updated [NuGet package](https://www.nuget.org/packages/QuadrupleLib), published via my GitHub Actions workflow. Alternatively, see the [Releases](https://github.com/IsaMorphic/QuadrupleLib/releases) page for a downloadable version you may use in your local or private feeds.
25
+
26
+
## Basic Usage
27
+
28
+
To use QuadrupleLib in your project, simply add the `PackageReference` to your `.csproj` file and add the following `using` statement to the top of any single file in your project:
The `Float128` type as defined above includes a full implementation of the .NET 8 `IBinaryFloatingPointIeee754<T>` generic arithmetic interface. You may use it as thus either generically or concretely. Generally, anywhere you're using `double` or `float` arithmetic, you can use `Float128` as a drop-in replacement and everything will work as expected.
35
+
36
+
## Defining `Float128` Constants
37
+
38
+
For defining high-precision constants, it is highly recommended that `Float128.Parse` is used with a given `const string`. While literal `double` and `long` values can be implicitly converted to `Float128`, you will not be able to specify the maximum amount of significant digits that you would otherwise be able to using the `Parse` method. See the example below for reference:
`Float128<TAccelerator>` is a generic type offered by the library which can accept one of two "accelerators" that are built-in: `DefaultAccelerator` and `SoftwareAccelerator`. The former uses typical hardware accelerated intrinsics for 128-bit multiplication and division operations, while the latter provides a custom, software defined version of the same thing. In almost all cases, you'll want to use `DefaultAccelerator`, unless you are running your code on a platform that does not include intrinsics for 128-bit arithmetic. In those cases, `SoftwareAccelerator` provides a faster alternative that is widely compatible. The most notable example of such a platform is when using QuadrupleLib in conjunction with [ILGPU](https://ilgpu.net), a JIT compiler for running .NET code on the GPU.
50
+
51
+
# Development Guide
52
+
53
+
Interested in tinkering with the source code? Feel free to fork this repo and/or clone it as a submodule in your project:
git commit -m "Feature: add QuadrupleLib as submodule"
58
+
cd external/QuadrupleLib
59
+
```
60
+
61
+
Then, to build the source code, make sure the .NET 10 SDK is installed on your machine, and run:
62
+
63
+
```bash
64
+
dotnet build --no-incremental
65
+
```
66
+
67
+
Next, to run unit tests, use the following command:
68
+
69
+
```bash
70
+
dotnet test --no-build
71
+
```
72
+
73
+
To build the NuGet package, use the following command:
74
+
75
+
```bash
76
+
dotnet pack --no-build --output build/
77
+
```
78
+
79
+
# Contributing
80
+
81
+
Before contributing any changes to the project, make sure that all the standard unit tests are passing. If your changes are a work-in-progress, please mark those PRs as drafts. I will not accept any changes which do not pass all existing unit tests; any new features should include new tests to cover them. Finally, do NOT contribute code written by Copilot or other LLMs. QuadrupleLib is written by humans, for humans.
0 commit comments