Tag: 浮点比较

为什么释放/debugging对std :: min有不同的结果?

这里是testing程序: void testFunc() { double maxValue = DBL_MAX; double slope = std::numeric_limits<double>::quiet_NaN(); std::cout << "slope is " << slope << std::endl; std::cout << "maxThreshold is " << maxValue << std::endl; std::cout << "the_min is " << std::min( slope, maxValue) << std::endl; std::cout << "the_min is " << std::min( DBL_MAX, std::numeric_limits<double>::quiet_NaN()) << std::endl; } int main( […]

在C ++中,正确的是<,==和>中的一个,在float上保证是真的?

在C ++中,我是否有保证,对于任何给定的float a和float b ,只有一个a < b , a == b和a > b是真的? 如果这在编译器和平台之间有所不同,我对x86上的Visual C ++感兴趣。