mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-16 06:06:36 +08:00
19 lines
582 B
C#
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
|
|
}
|
|
}
|
|
} |