1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 using System.Runtime.InteropServices;
6 using Internal.Runtime.CompilerServices;
10 internal static partial class Number
12 private const int NumberMaxDigits = 50;
14 private const double Log10V2 = 0.30102999566398119521373889472449;
16 // DriftFactor = 1 - Log10V2 - epsilon (a small number account for drift of floating point multiplication)
17 private const double DriftFactor = 0.69;
19 [StructLayout(LayoutKind.Sequential, Pack = 1)]
20 internal unsafe ref struct NumberBuffer
25 public NumberBufferKind kind;
26 public fixed char digits[NumberMaxDigits + 1];
28 public char* GetDigitsPointer()
30 // This is safe to do since we are a ref struct
31 return (char*)(Unsafe.AsPointer(ref digits[0]));
35 internal enum NumberBufferKind : byte