# Sion.Useful.Math 1.1.0

There is a newer version of this package available.
See the version list below for details.
```dotnet add package Sion.Useful.Math --version 1.1.0

```
```NuGet\Install-Package Sion.Useful.Math -Version 1.1.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="1.1.0" />

```
For projects that support PackageReference, copy this XML node into the project file to reference the package.
```paket add Sion.Useful.Math --version 1.1.0

```
```#r "nuget: Sion.Useful.Math, 1.1.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

// Install Sion.Useful.Math as a Cake Tool
#tool nuget:?package=Sion.Useful.Math&version=1.1.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 net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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)
• #### net6.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.