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 log and atan2 operations for floats #583

Closed
developedby opened this issue Jun 12, 2024 · 1 comment · Fixed by #585
Closed

Add log and atan2 operations for floats #583

developedby opened this issue Jun 12, 2024 · 1 comment · Fixed by #585
Assignees
Labels
enhancement New feature or request HVM About the HVM prelude Bend's builtin types and functions syntax About Bend's syntax

Comments

@developedby
Copy link
Member

HVM exposes log and atan2 operations, but they're not available in Bend except as a hack (using | and & operators).
We should expose them to users with a native operation.

I don't know what syntax to use other than log(a, b) and (log a b), but I don't really like it since it is different from all the other operators.

There multiple way to implement this:

  • Parsing log(a, b) as a numeric operation.
  • Defining a builtin function log a b = a & b. This is a bit of a hack and I don't love it, but it's the simplest.
  • Having a builtin stub log a b that gets converted into the numeric operation as a compiler pass.
@developedby developedby added enhancement New feature or request syntax About Bend's syntax prelude Bend's builtin types and functions HVM About the HVM labels Jun 12, 2024
@developedby
Copy link
Member Author

Personally I'm favorable to implementing as option 2 for now, as it is the easiest to change in the future.

@imaqtkatt imaqtkatt self-assigned this Jun 13, 2024
@imaqtkatt imaqtkatt linked a pull request Jun 13, 2024 that will close this issue
github-merge-queue bot pushed a commit that referenced this issue Jun 13, 2024
…ations-for-floats

#583 Add log and atan2 operations for floats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request HVM About the HVM prelude Bend's builtin types and functions syntax About Bend's syntax
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants