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

CodeGen: Automatically typecast to float during division #29

Open
alexdovzhanyn opened this issue Sep 23, 2024 · 2 comments
Open

CodeGen: Automatically typecast to float during division #29

alexdovzhanyn opened this issue Sep 23, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest A good issue to work on for Hacktoberfest help wanted Extra attention is needed

Comments

@alexdovzhanyn
Copy link
Collaborator

Currently, numbers in Theta are represented as i64's. When performing division, it is likely that the result will be a floating point number. In the current implementation this results in a truncation in the result, which is undesirable. We need to add a way to correctly typecast numbers to f64 if the result of the division is a floating point number.

Perhaps we should always typecast each operand to f64 before a division? We can cast back to an i64 if the result is a non-floating point number.

As part of this, it will also be necessary to detect what underlying type a number should use in WebAssembly during parsing. For example, if the source contains x<Number> = 4.0, the generated code should treat x as an f64, whereas x<Number> = 4 will treat is as an i64.

@alexdovzhanyn alexdovzhanyn added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers hacktoberfest A good issue to work on for Hacktoberfest labels Sep 23, 2024
@PranavKeshav24
Copy link

Please assign this issue to me. I would be very happy to work on it.

@AbdelrahmanKhaledd
Copy link
Contributor

I could work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest A good issue to work on for Hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants