Bug description
Calling toString on an f64 value works as expected, but doing the same on an f32 string introduces extra noise decimals. I suspect it is because the f32 value is being cast to f64 when passed into the dtoa function:
|
toString(this: f32, radix: i32 = 0): String { |
|
return dtoa(this); |
|
} |
|
export function dtoa(value: f64): String { |
Steps to reproduce
console.log((<f64>1.1).toString()); // "1.1"
console.log((<f32>1.1).toString()); // "1.100000023841858"
AssemblyScript version
v0.27.29
Bug description
Calling
toStringon anf64value works as expected, but doing the same on anf32string introduces extra noise decimals. I suspect it is because thef32value is being cast tof64when passed into thedtoafunction:assemblyscript/std/assembly/number.ts
Lines 317 to 319 in f79391c
assemblyscript/std/assembly/util/number.ts
Line 734 in f79391c
Steps to reproduce
AssemblyScript version
v0.27.29