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.
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
.