CodeGen: Automatically typecast to float during division #29
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
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 tof64
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 ani64
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 anf64
, whereasx<Number> = 4
will treat is as ani64
.The text was updated successfully, but these errors were encountered: