Commit graph

34 commits

Author SHA1 Message Date
Matthew Olsson
6c02ea39d1 LibM: Add more macros; increase precision of existing macros 2021-04-23 09:11:07 +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
Nicholas-Baron
73dd293ec4 Everywhere: Add -Wdouble-promotion warning
This warning informs of float-to-double conversions. The best solution
seems to be to do math *either* in 32-bit *or* in 64-bit, and only to
cross over when absolutely necessary.
2021-04-16 19:01:54 +02:00
AnotherTest
dbc5b05b7a LibM: Use fptan/fpatan instead of approximating atan2/tan
The previous versions were very inaccurate, and sometimes wrong.
2021-04-15 17:50:16 +02:00
Mițca Dumitru
01a49dda85 LibM: Implement fmin/fmax 2021-03-15 22:02:38 +01:00
Mițca Dumitru
987cc904c2 LibM: Make the gamma family of functions more accurate and conformant
This patch makes tgamma use an approximation that is more accurate with
regards to floating point arithmetic, and fixes some issues when tgamma
was called with positive integer values.

It also makes lgamma set signgam to the correct value, and makes its
return value be more inline with what the C standard defines.
2021-03-15 22:02:38 +01:00
Mițca Dumitru
2d0f334e5d LibM: Declare rintl in math.h 2021-03-15 22:02:38 +01:00
Mițca Dumitru
32b9437c13 LibM: Add remainder{f, l}
These just forward their arguments to fmod, but I think that should be
fine.
2021-03-14 21:43:08 +01:00
Mițca Dumitru
e4197b7854 LibM: Define HUGE_VAL{F,L} in terms of compiler builtins 2021-03-14 21:43:08 +01:00
Mițca Dumitru
e9533da0e7 LibM: Define MAXFLOAT
Looks like a POSIX extension
2021-03-14 21:43:08 +01:00
Mițca Dumitru
86ee9211be LibM: Define FLT_EVAL_METHOD, float_t and double_t 2021-03-14 21:43:08 +01:00
Mițca Dumitru
1f1a4f488f LibM: Declare ldexpl in math.h
It was already defined, but it wasn't declared in the header
2021-03-14 21:43:08 +01:00
Mițca Dumitru
93c554f6bd LibM: Add the gamma family of functions 2021-03-14 21:43:08 +01:00
Mițca Dumitru
7aac174bc8 LibM: Organise math.h so it is less of a wall of functions
The categories are the same categories used by cppreference on its page
for numeric functions.
2021-03-14 21:43:08 +01:00
Mițca Dumitru
c9601cdee3 LibM: Implement the missing parts of the round family 2021-03-14 21:43:08 +01:00
Mițca Dumitru
03b2d30836 LibM: Add missing float and long double function variants 2021-03-14 21:43:08 +01:00
Linus Groh
caa8f3d3bf LibM: Implement tanf() in terms of tan() with casts
Lazy, but it works for now. :^)
2021-03-13 22:44:16 +01:00
Mițca Dumitru
b07310dc8b LibM: Add nan{f, l} 2021-03-09 07:28:06 +01:00
Mițca Dumitru
efe4845c56 LibM: Implement more rounding functions
This patch implements the entire rint family, while taking into account
the current rounding mode, and implements ceil, round, trunc, and floor
for types which they weren't before.
2021-03-09 07:28:06 +01:00
Mițca Dumitru
88d342d007 LibM: Implement the frexp family 2021-03-09 07:28:06 +01:00
Mițca Dumitru
b274120b3c LibM: Implement copysign for float and long double 2021-03-09 07:28:06 +01:00
Mițca Dumitru
87b61b0eef LibM: Add scalbn and associated functions
Also implement ldexp in terms of them, and add ldexpl
2021-03-09 07:28:06 +01:00
Mițca Dumitru
352b383280 LibM: Add ilogb and logb 2021-03-09 07:28:06 +01:00
Mițca Dumitru
190952675e LibM: Specialiase FloatExtractor for long double as well 2021-03-09 07:28:06 +01:00
Mițca Dumitru
42a8186728 LibM: Define floating point comparsion macros 2021-03-09 07:28:06 +01:00
Mițca Dumitru
70737b42b2 LibM: Define math_errhandling and associated macros 2021-03-09 07:28:06 +01:00
Nick Wanninger
c3f417aa1e LibM: optimized (branchless) copysign 2021-03-06 09:42:06 +01:00
Andreas Kling
9f8a9dba0b LibM: Add naive implementation of copysign() 2021-03-05 20:46:25 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
Andreas Kling
0269578d3e LibM: Implement nextafter() and nexttoward()
Patch from Anonymous.
2021-02-05 12:27:23 +01:00
Andreas Kling
9d471ea923 LibM: Build and install the LibM test
This test seems to be full of wrong, but at least now we build it and
place it in /usr/Tests/LibM/ so that we can fix it.
2021-02-05 09:50:08 +01:00
Andreas Kling
6622ad8895 LibM: Improve accuracy of rounding related functions
Patch from Anonymous.
2021-02-05 09:38:45 +01:00
Linus Groh
c46056122a LibM: Add nextafter() and nexttoward() stubs
Only thing missing for Python to build the _math module! :^)
2021-01-18 22:28:56 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00