Skip to content
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 trigonometric function operators for F24 #384

Closed
developedby opened this issue Jun 9, 2024 · 1 comment · Fixed by #391
Closed

Add trigonometric function operators for F24 #384

developedby opened this issue Jun 9, 2024 · 1 comment · Fixed by #391
Labels
enhancement New feature or request

Comments

@developedby
Copy link
Member

Is your feature request related to a problem? Please describe.
A request by a Bend user in this issue: HigherOrderCO/Bend#570.

We have log, atan2 and pow for floats, but not trigonometric functions like sin, cos and tan.
I think they're common enough to warrant being a native operation. We should have at least one of them, the others could be easily derived (cos(x) = sqrt(1 - sin(x)²), etc)

Describe the solution you'd like
Add at least one of sin, cos and tan functions as a native floating point operation. We could use SHL and SHR tags to implement them for f24 types.

Describe alternatives you've considered
Approximating them using the already present operations. I think it can be done in around ~10-20 interactions each.

@Janiczek
Copy link

easily derived (cos(x) = sqrt(1 - sin(x)²))

I think you're missing an easier derivation:

cos x = sin (x + pi/2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants