-
-
Notifications
You must be signed in to change notification settings - Fork 672
Closed
Labels
Description
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:
assemblyscript/std/assembly/number.ts
Lines 317 to 319 in f79391c
toString(this: f32, radix: i32 = 0): String { | |
return dtoa(this); | |
} |
assemblyscript/std/assembly/util/number.ts
Line 734 in f79391c
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