Skip to content

Latest commit

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

RyuCsharp

使用 C# 实现的 Ryu ,一个高性能浮点数转换为字符串的算法。

Ryu, implemented by C#, a high-performance algorithm for converting floats to strings.

2023-09-21 RyuCsharp update descriptions:

  • To avoid managed memory fragmentation, the implementation was changed from pointers to references. (The difference between pointer and reference is that the former is an unmanaged pointer and the latter is a managed pointer.)
  • Inherit the open source license of the parent project to make it easier for everyone to use.
  • fix bugs.
  • Publish nuget package.

Usage example:

{// Arraychar[]charArray=newchar[32];// Need to ensure that the memory size is sufficient.varwrittenLength=Ryu.d2s_buffered_n(3.1415926D,refcharArray[0]);Console.WriteLine(newstring(charArray,0,writtenLength));// Output: 3.1415926E0}{// SpanSpan<char>charSpan=(newchar[32]).AsSpan();varwrittenLength=Ryu.d2s_buffered_n(3.1415926D,refcharSpan[0]);Console.WriteLine(charSpan.Slice(0,writtenLength).ToString());// Output: 3.1415926E0}{// Pointerchar*pChars=stackallocchar[32];Ryu.d2s_buffered(3.1415926D,ref*pChars);Console.WriteLine(newstring(pChars));// Output: 3.1415926E0}

About

RyuCsharp

Resources

Stars

12 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages