Add more functions to the math module #380
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a few extra functions to the math module including:
acosh
,asinh
, andatanh
(missing hyperbolic functions)cbrt
exp2
hypot
log2
round
The beginning basis of Lily's math module seems to have been constructed around the limitations of C89 of which a few other scripting languages restrict themselves to, however Lily seems to not be restricted to C89 as there are already other functions in the math library which require C99 or newer such as "
is_nan
" https://en.cppreference.com/w/c/numeric/math.htmlI was tempted to just add every applicable math function from C99 as Lily already has all the math functions from C89 however I was not sure if that would be desired or not so for this PR I have just added a few that I think make the most sense. although I am curious to know if just flat out including almost all of the C99 math functions would be acceptable in the context of Lily, if so then Ill submit a PR after to add more or something maybe.