IsFinite() equivalent

本文关键字:equivalent IsFinite | 更新日期: 2023-09-27 18:30:12

以下定义的C#替换是什么?

#define IS_FINITE(x) (0x7FF0 != (*((unsigned short*)(&x) + 3) & 0x7FF0))

可能是double.IsInfinity(x) == false还是double.IsNegativeInfinity(x) == false

谢谢。

IsFinite() equivalent

!double.IsInfinity(x) && !double.IsNaN(x)

参考文献:
http://pubs.opengroup.org/onlinepubs/009604499/functions/isfinite.html
http://msdn.microsoft.com/en-us/library/system.double.isinfinity.aspx
http://msdn.microsoft.com/en-us/library/system.double.isnan.aspx