Open mattjohnsonpint opened 2 months ago
Perhaps not the cast itself, but rather dtoa
is designed for 64-bit precision input value. If there were a 32-bit version of dtoa
and its dependent functions, then it should be possible to emit "1.1"
for an f32
.
Bug description
Calling
toString
on anf64
value works as expected, but doing the same on anf32
string introduces extra noise decimals. I suspect it is because thef32
value is being cast tof64
when passed into thedtoa
function:https://github.com/AssemblyScript/assemblyscript/blob/f79391c91a0875e98a6e887b3353210b4125dc87/std/assembly/number.ts#L317-L319
https://github.com/AssemblyScript/assemblyscript/blob/f79391c91a0875e98a6e887b3353210b4125dc87/std/assembly/util/number.ts#L734
Steps to reproduce
AssemblyScript version
v0.27.29