Commit Graph

37 Commits

Author SHA1 Message Date
Matthew Olsson
49c5acaa3d LibM: Fix Lagom build
isnormal really messes up the build. Just remove it for now; it can be
addressed in a seperate commit. Additionally, conditionally add
`noexcept` to the math functions if we are in a C++ context.
2020-07-26 14:53:43 +02:00
Matthew Olsson
3206263c2d LibM: Evaluate math macros, add M_DEG2RAD and M_RAD2DEG 2020-07-26 14:53:43 +02:00
AnotherTest
9054811ace LibM: Add 'isnormal' 2020-07-12 01:19:48 +02:00
stelar7
b97da17b90 LibM: Add some more math functions 2020-06-22 10:33:50 +02:00
Linus Groh
c883bab62a LibM: Add exp2() and exp2f() 2020-06-04 15:45:11 +02:00
Linus Groh
ead76377b0 LibM: Add INFINITY macro 2020-06-04 15:45:11 +02:00
Linus Groh
8a94813007 LibM: Add NAN macro 2020-06-04 15:45:11 +02:00
Sergey Bugaev
a449a0b977 LibM: Add M_SQRT2 and M_SQRT1_2 2020-05-24 23:30:12 +02:00
Andreas Kling
250c3b363d Revert "Build: Include headers from LibC, LibM, and LibPthread with -isystem"
This reverts commit c1eb744ff0.
2020-05-20 16:24:26 +02:00
Andrew Kaster
c1eb744ff0 Build: Include headers from LibC, LibM, and LibPthread with -isystem
Make sure that userspace is always referencing "system" headers in a way
that would build on target :). This means removing the explicit
include_directories of Libraries/LibC in favor of having it export its
headers as SYSTEM. Also remove a redundant include_directories of
Libraries in the 'serenity build' part of the build script. It's already
set at the top.

This causes issues for the Kernel, and for crt0.o. These special cases
are handled individually.
2020-05-20 08:37:50 +02:00
Andreas Kling
de7827faf7 LibM: Fix floor() and floorf() for negative numbers
And add a LibJS test to exercise the code. :^)
2020-05-15 22:05:59 +02:00
Andreas Kling
8f293b7543 LibM: Add floorf() for @rexim :^) 2020-05-15 21:51:02 +02:00
Sergey Bugaev
450a2a0f9c Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-14 20:15:18 +02:00
Valtteri Koskivuori
61cea6a29d LibM: Implement fmodf() 2020-05-02 01:23:30 +02:00
Andreas Kling
e97a229b90 LibM: Add (not very good) round() implementation 2020-04-15 19:11:53 +02:00
Linus Groh
220ecde626 LibM: Improve pow() and powf() 2020-04-06 20:31:48 +02:00
Linus Groh
c7b4b5fe00 LibM: Fix ceil() and ceilf() for negative numbers
These functions are using a naive approach: casting double/float to int
and returning the result + 1. That increment by one must only happen for
positive input values though.
2020-04-06 15:43:47 +02:00
Valtteri Koskivuori
24b5fd4c4c LibM: Implement floating point variants of various math functions 2020-02-25 20:48:42 +01:00
Andreas Kling
fb4930754e LibM: Install immediately after building 2020-02-06 14:28:35 +01:00
Andreas Kling
94ca55cefd Meta: Add license header to source files
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.

For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.

Going forward, all new source files should include a license header.
2020-01-18 09:45:54 +01:00
Andreas Kling
3b2f20ed4d LibM: Implement some naive functionality to make VVVVVV run 2020-01-13 19:01:44 +01:00
joshua stein
ac25438d54 Build: clean up build system, use one shared Makefile
Allow everything to be built from the top level directory with just
'make', cleaned with 'make clean', and installed with 'make
install'.  Also support these in any particular subdirectory.

Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as
it runs.

Kernel and early host tools (IPCCompiler, etc.) are built as
object.host.o so that they don't conflict with other things built
with the cross-compiler.
2019-12-20 20:20:54 +01:00
Valtteri Koskivuori
b8ac14a873 LibM: Implement pow() 2019-12-10 16:24:47 +01:00
Emanuel Sprung
e7affa24dc LibC, LibM: Add functions needed to compile python3 2019-11-11 22:04:16 +01:00
Andreas Kling
4565b2d2d9 LibM: Add back ampsin() since it was still used by tan() 2019-11-03 09:59:44 +01:00
Jesse
bcf3a4457f LibM: Fixed sin() precision (#726)
The old implementation of sin() had a very unacceptable amount of
error that was causing a lot of texture perspective issues in Quake.
This has been remedied through the use of the hardware `fsin`
x87 instruction. As has been noted in #246, this instruction is both
very slow, and can become wildly inaccurate for more precise values,
however the current implementation made an incorrect assumption about
applications "will end up writing their own implemtnation anyways",
which is not the case for Quake in Software mode, which relies heavily
on a correct `sin()` and `cos()` function for `R_ScanEdges()`.

Realistically, we should be using something like the CORDIC algorithm
(https://en.wikipedia.org/wiki/CORDIC) or `Taylor Expansion`, however
for now these provides a somewhat accurate result that allows Quake to
run without any texture or geometry issues.
2019-11-03 09:56:39 +01:00
George Pickering
704f48d7f3 POSIX compliance: (most) shell scripts converted to generic shell
Ports/.port_include.sh, Toolchain/BuildIt.sh, Toolchain/UseIt.sh
have been left largely untouched due to use of Bash-exclusive
functions and variables such as $BASH_SOURCE, pushd and popd.
2019-11-03 09:26:22 +01:00
Andreas Kling
570c6c8458 LibM: Make roundf() and ceilf() slightly less terrible
These implementations still don't handle all of the corner cases that
are possible, but at least they are somewhat usable now.
2019-10-20 17:20:20 +02:00
Andreas Kling
9eaaaeec6e LibM: Add dummy implementations of roundf() and ceilf()
I though I could just use __builtin_roundf() and __builtin_ceilf() but
it seems like I can't, as they just become calls to roundf and ceilf.
2019-10-20 12:55:55 +02:00
Andreas Kling
c13be2c7ea LibM: Implement various functions.
Path from Anonymous.
2019-10-17 09:32:24 +02:00
Andreas Kling
dd696e7c75 LibM: Fix Toolchain build
We can't rely on libstdc++ inside LibC or LibM, since these libraries
are part of the Toolchain bringup build.
2019-09-29 22:07:02 +02:00
Andreas Kling
941981ec4f LibM: Implement various trig functions
Patch from Anonymous.
2019-09-29 21:04:08 +02:00
Sergey Bugaev
cfe8fdd5aa LibM: Implement sqrt()
Use the x87 fsqrt instruction for that.

We cannot use __builtin_sqrt(), since GCC expands it into
a sqrt() call, so we just loop endlessly.
2019-08-10 08:46:22 +02:00
Andreas Kling
0ef13e60b0 Libraries: Fix wrong paths to "Root" in the various install.sh scripts.
We were installing libraries into /Libraries/Root, rather than in /Root.
This made the ports system behave rather unpredictable, since I had old
versions of things in /Root and new versions of things in /Libraries/Root.
2019-07-21 21:38:30 +02:00
Andreas Kling
c7ea94697e Libraries: Remove unused "install" targets.
We've been using a per-directory "install.sh" for some time, so let's get
rid of the old way of doing things.
2019-07-21 21:28:48 +02:00
Andreas Kling
8b0953a795 Libraries: Unbreak "make install" with new directory locations. 2019-07-04 16:41:42 +02:00
Andreas Kling
04b9dc2d30 Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch
moves the Lib*/ directories into Libraries/.
2019-07-04 16:16:50 +02:00