Sion.Useful.Math 2.0.0

dotnet add package Sion.Useful.Math --version 2.0.0                
NuGet\Install-Package Sion.Useful.Math -Version 2.0.0                
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="Sion.Useful.Math" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sion.Useful.Math --version 2.0.0                
#r "nuget: Sion.Useful.Math, 2.0.0"                
#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.
// Install Sion.Useful.Math as a Cake Addin
#addin nuget:?package=Sion.Useful.Math&version=2.0.0

// Install Sion.Useful.Math as a Cake Tool
#tool nuget:?package=Sion.Useful.Math&version=2.0.0                

Sion.Useful.Math

NuGet package that provides static and extension methods to float, double, and decimal.

Sion.Useful.Math.NumberManipulation

public static float Truncate(this float f, int precision)
public static double Truncate(this double d, int precision)
public static decimal Truncate(this decimal d, int precision)

How to use

First, download the Sion.Useful.Math NuGet package, then include this using statement at the top of the file:

using Sion.Useful.Math;

NumberManipulation

Truncating a decimal point number
// Using extension methods
float f = 12.567f;
f = f.Truncate(2); // 12.56f

double d1 = 8.291;
d1 = d1.Truncate(1); // 8.2

decimal d2 = 85.1235m;
d2 = d2.Truncate(3); // 85.123m
// Using static methods
float f = 12.567f;
f = NumberManipulation.Truncate(f, 2); // 12.56f

double d1 = 8.291;
d1 = NumberManipulation.Truncate(d1, 1); // 8.2

decimal d2 = 85.1235m;
d2 = NumberManipulation.Truncate(d2, 3); // 85.123m
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.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.

Version Downloads Last updated
2.0.0 124 2/2/2024
1.1.0 179 6/26/2023
1.0.0 162 6/13/2023

Update to .NET 8.