From: Tanner Gooding Date: Thu, 7 Nov 2019 21:06:32 +0000 (-0800) Subject: Updating NumberToFloatingPointBitsSlow to handle the remaining parsed fractional... X-Git-Tag: submit/tizen/20210909.063632~11030^2~81 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9b296eea53b53a2f67bd626322cc61468e9ad41b;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Updating NumberToFloatingPointBitsSlow to handle the remaining parsed fractional digits being zero. (dotnet/coreclr#27688) Commit migrated from https://github.com/dotnet/coreclr/commit/460b97aa406f10cf9ab19e6398e1e1a72fc58b48 --- diff --git a/src/libraries/System.Private.CoreLib/src/System/Number.NumberToFloatingPointBits.cs b/src/libraries/System.Private.CoreLib/src/System/Number.NumberToFloatingPointBits.cs index 3443622..98ad9f2 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Number.NumberToFloatingPointBits.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Number.NumberToFloatingPointBits.cs @@ -484,7 +484,16 @@ namespace System } AccumulateDecimalDigitsIntoBigInteger(ref number, fractionalFirstIndex, fractionalLastIndex, out BigInteger fractionalNumerator); - Debug.Assert(!fractionalNumerator.IsZero()); + + if (fractionalNumerator.IsZero()) + { + return ConvertBigIntegerToFloatingPointBits( + ref integerValue, + in info, + integerBitsOfPrecision, + fractionalDigitsPresent != 0 + ); + } BigInteger.Pow10(fractionalDenominatorExponent, out BigInteger fractionalDenominator);