summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2021-05-22 02:47:05 +0200
committerLinus Groh <mail@linusgroh.de>2021-05-22 13:38:34 +0100
commit213767504740032338e41abe7996822aa766648a (patch)
treed1f8f0fe8b3f05ae1ca96d47c012c5538b057634
parent661a8707f04e4e6d3dee0df19f34b3f37126b1cb (diff)
downloadserenity-213767504740032338e41abe7996822aa766648a.zip
AK/NumericLimits: Add `lowest()` for floating-point types
-rw-r--r--AK/NumericLimits.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/AK/NumericLimits.h b/AK/NumericLimits.h
index 783e3adbe3..66eb28f8ca 100644
--- a/AK/NumericLimits.h
+++ b/AK/NumericLimits.h
@@ -101,6 +101,7 @@ struct NumericLimits<unsigned long long> {
#ifndef KERNEL
template<>
struct NumericLimits<float> {
+ static constexpr float lowest() { return -__FLT_MAX__; }
static constexpr float min() { return __FLT_MIN__; }
static constexpr float max() { return __FLT_MAX__; }
static constexpr float epsilon() { return __FLT_EPSILON__; }
@@ -109,6 +110,7 @@ struct NumericLimits<float> {
template<>
struct NumericLimits<double> {
+ static constexpr double lowest() { return -__DBL_MAX__; }
static constexpr double min() { return __DBL_MIN__; }
static constexpr double max() { return __DBL_MAX__; }
static constexpr double epsilon() { return __DBL_EPSILON__; }
@@ -117,6 +119,7 @@ struct NumericLimits<double> {
template<>
struct NumericLimits<long double> {
+ static constexpr long double lowest() { return -__LDBL_MAX__; }
static constexpr long double min() { return __LDBL_MIN__; }
static constexpr long double max() { return __LDBL_MAX__; }
static constexpr long double epsilon() { return __LDBL_EPSILON__; }