mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +00:00
Everywhere: Use AK/Math.h if applicable
AK's version should see better inlining behaviors, than the LibM one. We avoid mixed usage for now though. Also clean up some stale math includes and improper floatingpoint usage.
This commit is contained in:
parent
c5f6ba6e71
commit
ed46d52252
40 changed files with 116 additions and 156 deletions
|
@ -4,21 +4,21 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Math.h>
|
||||
#include <LibJS/Runtime/AbstractOperations.h>
|
||||
#include <LibJS/Runtime/Error.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/NumberConstructor.h>
|
||||
#include <LibJS/Runtime/NumberObject.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __clang__
|
||||
# define EPSILON_VALUE pow(2, -52)
|
||||
# define MAX_SAFE_INTEGER_VALUE pow(2, 53) - 1
|
||||
# define MIN_SAFE_INTEGER_VALUE -(pow(2, 53) - 1)
|
||||
# define EPSILON_VALUE AK::exp2(-52.)
|
||||
# define MAX_SAFE_INTEGER_VALUE AK::exp2(53.) - 1
|
||||
# define MIN_SAFE_INTEGER_VALUE -(AK::exp2(53.) - 1)
|
||||
#else
|
||||
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) };
|
||||
constexpr const double EPSILON_VALUE { __builtin_exp2(-52) };
|
||||
constexpr const double MAX_SAFE_INTEGER_VALUE { __builtin_exp2(53) - 1 };
|
||||
constexpr const double MIN_SAFE_INTEGER_VALUE { -(__builtin_exp2(53) - 1) };
|
||||
#endif
|
||||
|
||||
namespace JS {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue