summaryrefslogtreecommitdiff
path: root/AK/Math.h
AgeCommit message (Collapse)Author
2022-06-30AK: Add AK::ceil(float) and AK::ceil_log2(integer)MacDue
Co-authored-by: Leon Albrecht <leon2002.la@gmail.com>
2022-06-14AK: Add sqrt(2) and sqrt(1/2) constantsHediadyoin1
2022-05-08AK: Use AK:: sin and cos on aarch64 buildEWouters
This fixes the lagom build on aarch64, as `__builtin_sincosf` doesn't take double arguments.
2022-05-07AK: Use builtin versions of `llrint{,l,f}`EWouters
This fixes the build on M1 Macs.
2022-05-07AK: Add an SSE2 specific implementation of sqrt(double)Hendiadyoin1
2022-05-07AK: Add an helper for quick hardware based roundingHendiadyoin1
This uses the `fistp` and `cvts[sd]2si` respectively, to potentially round floating point values with just one instruction. This falls back to `llrint[fl]?` on aarch64 for now.
2022-04-23AK: Make sure we don't include Math.h or math.h from KERNELAndrew Kaster
2022-04-03AK: Add generic sincos solution for non-x86 platformsserenityosrocks
2022-04-02AK: Add rsqrt and a SSE specific implementation for sqrtHendiadyoin1
2022-03-15AK+Everywhere: Add sincos and use it in some placesHendiadyoin1
Calculating sin and cos at once is quite a bit cheaper than calculating them individually. x87 has even a dedicated instruction for it: `fsincos`.
2022-02-19AK: Don't use x86 assembly when building for non-x86 targetsGunnar Beutner
This allows Lagom to be built successfully for Apple M1. Fixes #12644.
2022-02-06AK: Move integral log2 and exp to IntegerMath.hHendiadyoin1
2022-01-29AK: Fix log2 calculation for IntegerPankaj Raghav
For a `N` bit integer X, the log2 calculation should be as follows: (N - 1) - ctz(X)
2021-12-21AK+Everywhere: Replace __builtin bit functionsNick Johnson
In order to reduce our reliance on __builtin_{ffs, clz, ctz, popcount}, this commit removes all calls to these functions and replaces them with the equivalent functions in AK/BuiltinWrappers.h.
2021-11-18AK: Implement `acos<T>` correctlyJelle Raaijmakers
This is a naive implementation based on the symmetry with `asin`. Before, I'm not really sure what we were doing, but it was returning wildly incorrect results.
2021-08-08AK: Handle partial remaindersDaniel Bertalan
On x86, the `fprem` and `fmprem1` instructions may produce a 'partial remainder', for which we should check by reading a FPU flag. If we don't check for it, we may end up using values that are outside the expected range of values.
2021-07-19AK: Introduce Math.hHendiadyoin1
This is to implement constexpr template based implementations for mathematical functions This also changes math.cpp to use these implementations. Also adds a fastpath for floating point trucation for values smaller than the signed 64 bit limit.