Soenneker.Extensions.Double
4.0.467
Prefix Reserved
dotnet add package Soenneker.Extensions.Double --version 4.0.467
NuGet\Install-Package Soenneker.Extensions.Double -Version 4.0.467
<PackageReference Include="Soenneker.Extensions.Double" Version="4.0.467" />
<PackageVersion Include="Soenneker.Extensions.Double" Version="4.0.467" />
<PackageReference Include="Soenneker.Extensions.Double" />
paket add Soenneker.Extensions.Double --version 4.0.467
#r "nuget: Soenneker.Extensions.Double, 4.0.467"
#:package Soenneker.Extensions.Double@4.0.467
#addin nuget:?package=Soenneker.Extensions.Double&version=4.0.467
#tool nuget:?package=Soenneker.Extensions.Double&version=4.0.467
Soenneker.Extensions.Double
Small conversion and absolute-tolerance comparison extensions for double.
Installation
dotnet add package Soenneker.Extensions.Double
Convert to int
using Soenneker.Extensions.Double;
int lowerEven = 2.5d.ToInt(); // 2
int upperEven = 3.5d.ToInt(); // 4
ToInt() delegates to Convert.ToInt32(double). It rounds to the nearest integer using midpoint-to-even rounding and throws OverflowException for NaN, infinity, or a rounded result outside the Int32 range.
Compare with an absolute tolerance
bool close = 0.1d.NearlyEqual(0.10001d, epsilon: 0.0001d); // true
bool far = 1000d.NearlyEqual(1001d, epsilon: 0.5d); // false
NearlyEqual() checks whether the absolute difference is less than or equal to epsilon. Matching positive infinities and matching negative infinities are equal. NaN never matches, and an infinity does not match a different value even when epsilon is infinite. A negative or NaN tolerance produces false unless the two inputs are already exactly equal.
This method does not scale tolerance with the magnitude of the values. For measurements spanning very different scales, choose an epsilon appropriate to the domain or use a relative-tolerance comparison instead.
| 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. |
-
net10.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Soenneker.Extensions.Double:
| Package | Downloads |
|---|---|
|
Soenneker.Utils.BackgroundQueue
A high-performance background Task/ValueTask queue |
|
|
Soenneker.Maui.Blazor.Bridge
Seamlessly connects MAUI and Blazor, enabling smooth integration of native components into Blazor |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.467 | 17,407 | 8/30/2026 |
| 4.0.466 | 2,141 | 8/29/2026 |
| 4.0.465 | 711 | 8/29/2026 |
| 4.0.464 | 171,147 | 7/28/2026 |
| 4.0.463 | 79,242 | 7/16/2026 |
| 4.0.462 | 91,322 | 6/18/2026 |
| 4.0.461 | 95,667 | 6/5/2026 |
| 4.0.460 | 127 | 6/5/2026 |
| 4.0.459 | 132,402 | 4/22/2026 |
| 4.0.458 | 90,088 | 3/12/2026 |
| 4.0.457 | 185 | 3/12/2026 |
| 4.0.456 | 183 | 3/12/2026 |
| 4.0.455 | 1,635 | 3/12/2026 |
| 4.0.454 | 30,140 | 3/10/2026 |
| 4.0.453 | 18,597 | 3/9/2026 |
| 4.0.452 | 1,222 | 3/9/2026 |
| 4.0.451 | 185 | 3/9/2026 |
| 4.0.450 | 33,022 | 3/4/2026 |
| 4.0.449 | 155,896 | 1/6/2026 |
| 4.0.448 | 17,906 | 1/2/2026 |
Handle infinite double comparisons and improve documentation