Commit Graph

12 Commits

Author SHA1 Message Date
Tim Ledbetter
5ca2f4dfd7 Everywhere: Remove all KERNEL #defines 2024-06-18 09:36:25 +02:00
Daniel Bertalan
0cd85ab0fc AK+LibJS: Make Number.MIN_VALUE a denormal
ECMA-262 implies that `MIN_VALUE` should be a denormalized value if
denormal arithmetic is supported. This is the case on x86-64 and AArch64
using standard GCC/Clang compilation settings.

test262 checks whether `Number.MIN_VALUE / 2.0` is equal to 0, which
only holds if `MIN_VALUE` is the smallest denormalized value.

This commit renames the existing `NumericLimits<FloatingPoint>::min()`
to `min_normal()` and adds a `min_denormal()` method to force users to
explicitly think about which one is appropriate for their use case. We
shouldn't follow the STL's confusingly designed interface in this
regard.
2023-07-02 21:19:09 +01:00
Timothy Flynn
9423662107 AK: Add NumericLimits::digits to return the number of digits in a type
Analogous to std::numeric_limits<T>::digits.
2023-03-29 07:19:14 +02:00
Andreas Kling
ae3ffdd521 AK: Make it possible to not using AK classes into the global namespace
This patch adds the `USING_AK_GLOBALLY` macro which is enabled by
default, but can be overridden by build flags.

This is a step towards integrating Jakt and AK types.
2022-11-26 15:51:34 +01:00
Andrew Kaster
07f4e91b94 AK: Use proper type for bool NumericLimits::min and max specialization
We had these declared as returning char, which looks like a copy paste
error. Found by clang-tidy.
2021-11-14 22:52:35 +01:00
Jelle Raaijmakers
2137675047 AK/NumericLimits: Add lowest() for floating-point types 2021-05-22 13:38:34 +01:00
Stephan Unverwerth
0a557d65a0 AK: Add epsilon() to NumericLimits for float, double, long double 2021-05-08 10:13:22 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
asynts
f221a95a71 AK: Add NumericLimits specialization for char.
This is yet another bug because of the 'char'/'signed char'/'unsigned char' shit.
2020-09-29 16:14:58 +02:00
Andreas Kling
70cb4491d7 AK: Use "signed char" as the opposite of "unsigned char"
I totally forgot about the C++ basics here. There are three distinct
types: "char", "signed char" and "unsigned char". Whether "char" is
signed or unsigned is implementation specific.
2020-07-18 17:57:40 +02:00
Andreas Kling
6cefb96e98 AK: Allow NumericLimits.h to compile in a kernel context
We explicitly disallow floating point numbers during kernel compilation
so we have to #ifdef out those parts here.
2020-05-23 15:25:43 +02:00
Andreas Kling
ca2052ae4a AK: Add a simple NumericLimits<T> template
This provides min(), max() and is_signed() for the basic integer types.
2020-04-15 16:58:46 +02:00