Double.NEGATIVE_INFINITY

Hi ALL

are there equivalent in C++ for Double.NEGATIVE_INFINITY,Double.POSITIVE_INFINITY and Double.NaN in Java?

Txs
If std::numeric_limits<double>::is_iec559 is true, then:
std::numeric_limits<double>::infinity() and -std::numeric_limits<double>::infinity()


Else, if std::numeric_limits<double>::has_infinity is true, then:
std::numeric_limits<double>::infinity().

-std::numeric_limits<double>::infinity() would still work on most implementations (though the IS does not guarantee that).


If std::numeric_limits<double>::has_infinity is false, then the underlying representation of double on the particular platform is incapable of representing an infinite value.


std::numeric_limits<double>::quiet_NaN() would give you a non-signalling NaN if there is one on the particular platform ie. std::numeric_limits<double>::has_quiet_NaN is true.

std::numeric_limits<double>::signaling_NaN() would give you a signalling NaN if there is one on the particular platform ie. std::numeric_limits<double>::has_signaling_NaN is true.


Last edited on
Topic archived. No new replies allowed.