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 multiply-high operation #365

Open
CatsAreFluffy opened this issue May 31, 2024 · 3 comments
Open

Add multiply-high operation #365

CatsAreFluffy opened this issue May 31, 2024 · 3 comments

Comments

@CatsAreFluffy
Copy link

Is your feature request related to a problem? Please describe.
Currently, multiplying numbers with more than 24 bits is awkward, since you can only access the lower 24 bits of the full 48-bit result.

Describe the solution you'd like
A new primitive operation that multiplies two numbers and returns the high half of the product.

Describe alternatives you've considered
Waiting for native support for bigger numbers (and then asking for multiply-high for those since people will always need bigger numbers)

Additional context

@enricozb
Copy link
Contributor

We probably won't add this, and will instead just suggest using the extended numerics (#319) once support for that is added.

@VictorTaelin
Copy link
Member

Wait why not? Looks like a great idea actually. Now that I think about it, a set of opcodes to allow for u48 implementations using (u24,u24) tuples look like an amazing intermediate between fast unboxed numbers and slow boxed ones. Perhaps we could actually implement native u48's as (CON u24 u24)?

@enricozb
Copy link
Contributor

enricozb commented Jun 2, 2024

We could add it, but we'd be supporting quite a few numeric representations though.

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

No branches or pull requests

3 participants