-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add inverse hyperbolic functions asinh()
, acosh()
& atanh()
#78404
Conversation
Aside from me being super clumsy with the syntax (working on it) I am not super-sure about the clamping to infinity- want to see what people think and will update docs to reflect those special cases if agreed. |
cc @lawnjelly Any thoughts on clamping |
I don't think I've used it, but yes clamping result to |
This is what it now would say on
For
I've also added checks of infinity sign in tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
asinh()
, acosh()
& atanh()
Needs a rebase/update after #78108. |
GDScript has the following built-in trigonometry functions: - `sin()` - `cos()` - `tan()` - `asin()` - `acos()` - `atan()` - `atan()` - `sinh()` - `cosh()` - `tanh()` However, it lacks the hyperbolic arc (also known as inverse hyperbolic) functions: - `asinh()` - `acosh()` - `atanh()` Implement them by just exposing the C++ Math library, but clamping its values to the closest real defined value. For the cosine, clamp input values lower than 1 to 1. In the case of the tangent, where the limit value is infinite, clamp it to -inf or +inf. References godotengine#78377 Fixes godotengine/godot-proposals#7110
0dfebe8
to
528a764
Compare
I rebased to head. Let's see if that works, as I was getting some errors on HEAD before the patch applied - it was giving me some unit testing errors unrelated to the Math module. |
The errors I got were wrong compiling flags I was using. Unit tests for the new functionality (and the rest) still work normally after manual rebase @kleonc |
Thanks! |
GDScript has the following built-in trigonometry functions:
sin()
cos()
tan()
asin()
acos()
atan()
atan()
sinh()
cosh()
tanh()
However, it lacks the hyperbolic arc (also known as inverse
hyperbolic) functions:
asinh()
acosh()
atanh()
Implement them by just exposing the C++ Math library, but clamping
its values to the closes real defined value.
For the cosine, clamp input values lower than 1 to 1.
In the case of the tangent, where the limit value is infinite,
clamp it to -inf or +inf.
References #78377
Fixes godotengine/godot-proposals#7110