似乎我们可以轻易地得到比
numeric_limits<float>::min()
更小的浮点数。为什么呢?如果numeric_limits<float>::min()
不是最小的正浮点数,那它应该是什么呢?#include <iostream>
#include <limits>
using namespace std;
int main(){
float mind = numeric_limits<float>::min();
float smaller_than_mind = numeric_limits<float>::min()/2;
cout<< ( mind > smaller_than_mind && smaller_than_mind > 0 ) <<endl;
}
Run it here: https://onlinegdb.com/ry3AcxjXz