以下定義的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