std::numeric_limits<T>::infinity()
function is logically misbehaving for integral types but for double its working fine. Is there some reason for defining such behavior in standard library, which returns 0 instead of builtin_huge value in case of integral types?
#include<iostream>
#include<limits>
int main() {
std::cout << std::boolalpha;
std::cout << (9 < std::numeric_limits<int>::infinity()) << std::endl; // returns false
std::cout << (9 > std::numeric_limits<int>::infinity()) << std::endl; // returns true
std::cout << (9 < std::numeric_limits<long>::infinity()) << std::endl; // returns false
std::cout << (9 > std::numeric_limits<long>::infinity()) << std::endl; // returns true
std::cout << (9 < std::numeric_limits<double>::infinity()) << std::endl; // returns true
std::cout << (9 > std::numeric_limits<double>::infinity()) << std::endl; // returns false
}