From b98b83712f2d6a5756ad9464f6ff81d9489789cb Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 16 Oct 2020 14:28:17 +0200 Subject: [PATCH] LibJS: `constexpr` some Number object constant values --- Libraries/LibJS/Runtime/NumberConstructor.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Libraries/LibJS/Runtime/NumberConstructor.cpp b/Libraries/LibJS/Runtime/NumberConstructor.cpp index 4eb26f1211..6453fd840e 100644 --- a/Libraries/LibJS/Runtime/NumberConstructor.cpp +++ b/Libraries/LibJS/Runtime/NumberConstructor.cpp @@ -30,10 +30,9 @@ #include #include -// FIXME: constexpr these? -#define EPSILON_VALUE pow(2, -52) -#define MAX_SAFE_INTEGER_VALUE pow(2, 53) - 1 -#define MIN_SAFE_INTEGER_VALUE -(pow(2, 53) - 1) +constexpr const double EPSILON_VALUE { __builtin_pow(2, -52) }; +constexpr const double MAX_SAFE_INTEGER_VALUE { __builtin_pow(2, 53) - 1 }; +constexpr const double MIN_SAFE_INTEGER_VALUE { -(__builtin_pow(2, 53) - 1) }; namespace JS {