Files
aistudio-wpf-diagram/Others/Fluent.Ribbon/Fluent.Ribbon/Helpers/DoubleHelper.cs
2023-04-16 20:11:40 +08:00

19 lines
582 B
C#

namespace Fluent.Helpers
{
using System.Runtime.CompilerServices;
internal static class DoubleHelper
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsFinite(double value)
{
#if NETCOREAPP3_0
return double.IsFinite(value);
#else
// Copied from https://source.dot.net/#System.Private.CoreLib/shared/System/Double.cs,02ee32eb42d32941
var bits = System.BitConverter.DoubleToInt64Bits(value);
return (bits & 0x7FFFFFFFFFFFFFFF) < 0x7FF0000000000000;
#endif
}
}
}