以下定义的C#替换是什么?IsFinite()等效
#define IS_FINITE(x) (0x7FF0 != (*((unsigned short*)(&x) + 3) & 0x7FF0))
也许double.IsInfinity(x) == false
或double.IsNegativeInfinity(x) == false
?
谢谢。
以下定义的C#替换是什么?IsFinite()等效
#define IS_FINITE(x) (0x7FF0 != (*((unsigned short*)(&x) + 3) & 0x7FF0))
也许double.IsInfinity(x) == false
或double.IsNegativeInfinity(x) == false
?
谢谢。
!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
他已经知道C#的方式,他在问C++的方式。 – Powerlord 2012-04-05 14:09:02
@Powerlord其实“我需要将C++代码翻译成C#...” – phadaphunk 2012-04-05 14:10:39
@PhaDaPhunk哇,那么显然我完全误读了这个问题。 – Powerlord 2012-04-05 14:12:27
这是 '[新数学(http://en.wikipedia.org/wiki/New_math)',对不对? :) – AakashM 2012-04-05 14:02:30
有可能没有类似的替代品。你想达到什么目的? – raveturned 2012-04-05 14:02:36
双类有IsInfinity方法,如果你指的是双打 – 2012-04-05 14:04:06