Skip to content

Commit

Permalink
Handling NaN for double->ulong
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepakRajendrakumaran committed Mar 6, 2024
1 parent a4ec0d4 commit 2169219
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libraries/System.Private.CoreLib/src/System/Math.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,9 @@ private static double ULongToDouble(ulong val)

private static ulong DoubleToULong(double val)
{
if (double.IsNaN(val))
return 0;

const double two63 = 2147483648.0 * 4294967296.0;
ulong ret;
if (val < two63)
Expand Down

0 comments on commit 2169219

Please sign in to comment.