FixedPointNano 1.0.1
dotnet add package FixedPointNano --version 1.0.1
NuGet\Install-Package FixedPointNano -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FixedPointNano" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FixedPointNano" Version="1.0.1" />
<PackageReference Include="FixedPointNano" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FixedPointNano --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: FixedPointNano, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FixedPointNano@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FixedPointNano&version=1.0.1
#tool nuget:?package=FixedPointNano&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
FixedPointNano
FixedPointNano is a small C# library for representing fixed-point numeric values using an Int64 scaled to 9 decimal places.
Design
- Storage type:
long - Scale:
1_000_000_000 - Precision: 9 decimal places
- Target runtime: .NET 10
The library is intended for domains where deterministic 9-decimal fixed-point values are preferred over binary floating-point storage.
Features
- Deterministic
long-backed storage - Conversion operators for .NET numeric types
IConvertiblesupport- Standard numeric formatting via
ToString(...)andTryFormat(...) - Raw scaled arithmetic and comparison operators
- Fast helper methods for
Square,Sqrt, population variance/standard deviation, integer division, and ratio multiplication - Explicit finite-only
doubleconversion with nano-scale rounding
Example
using Seerstone;
var price = (FixedPointNano)123.456789123m;
var quantity = (FixedPointNano)2;
var total = price * quantity;
var average = FixedPointNano.Divide(total, 2);
var volatility = FixedPointNano.Sqrt(FixedPointNano.Square(price - average));
Console.WriteLine(total.ToString("F9"));
Benchmarks
BenchmarkDotNet microbenchmarks live under benchmarks/FixedPointNano.Benchmarks.
They compare FixedPointNano raw math against decimal-reference and double-reference paths.
Run a short local pass with:
dotnet run --project benchmarks/FixedPointNano.Benchmarks/FixedPointNano.Benchmarks.csproj -c Release -- --filter "*" --warmupCount 1 --iterationCount 1
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.