Nullable double NaN comparison in C#

后端 未结 4 1790
独厮守ぢ
独厮守ぢ 2021-01-12 18:03

I have 2 nullable doubles, an expected value and an actual value (let\'s call them value and valueExpected). A percentage is found using 100 * (value / valueExpected). Howev

4条回答
  •  暖寄归人
    2021-01-12 18:53

    I had the same issue and I solved it with casting the double? with double

    double.IsNaN((double)myDouble)
    

    this will return true if NaN and false if not

提交回复
热议问题