Zmij 1.1.0
dotnet add package Zmij --version 1.1.0
NuGet\Install-Package Zmij -Version 1.1.0
<PackageReference Include="Zmij" Version="1.1.0" />
<PackageVersion Include="Zmij" Version="1.1.0" />
<PackageReference Include="Zmij" />
paket add Zmij --version 1.1.0
#r "nuget: Zmij, 1.1.0"
#:package Zmij@1.1.0
#addin nuget:?package=Zmij&version=1.1.0
#tool nuget:?package=Zmij&version=1.1.0
Zmij.NET
C# port of Zmij, an extremely fast double-to-string conversion algorithm.
Overview
Zmij.NET is a C# port of Zmij.
Zmij is a fast dtoa implementation by the author of the C++ {fmt} library. It is based on Schubfach and xjb and is even faster than fast dtoa algorithms such as Ryu and Dragonbox.
Installation
.NET CLI
dotnet add package Zmij
Unity
In Unity, you can install Zmij.NET from NuGetForUnity
Quick Start
using ZmijNet; // namespace
double value = 1.234567890123456;
Console.WriteLine(Zmij.ToString(value)); // 1.234567890123456
float single = 3.14f;
Console.WriteLine(Zmij.ToString(single)); // 3.14
Span<byte> buffer = stackalloc byte[20];
Zmij.TryWrite(value, buffer, out int bytesWritten);
ZmijDecimal d = Zmij.ToDecimal(value);
Console.WriteLine(d.Significand); // 12345678901234560
Console.WriteLine(d.Exponent); // -16
Console.WriteLine(d.IsNegative); // False
Benchmarks
The following are benchmark results for converting 10,000 random double values to string or Span<byte>.
| Method | Mean | Error | StdDev |
|---|---|---|---|
| System_DoubleToString | 770.4 us | 14.73 us | 12.30 us |
| System_Utf8Formatter | 731.7 us | 13.77 us | 12.21 us |
| Zmij_ToString | 421.3 us | 8.29 us | 12.16 us |
| Zmij_TryWrite | 323.2 us | 3.97 us | 3.52 us |
License
This repository is under the MIT License.
Please refer to the Żmij license here: https://github.com/dtolnay/zmij/blob/master/LICENSE-MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. net11.0 is compatible. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
-
net10.0
- No dependencies.
-
net11.0
- No dependencies.
-
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.