Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

avoid floats (fixed point arithmetic saved quite a bit of space)

Can someone help me understand how this works? I thought JavaScript uses doubles for everything. Is WASM completely different in this regard?



WASM has 32-bit and 64-bit integer and float types:

https://webassembly.github.io/spec/core/syntax/types.html

(...and additionally can load/store 8- and 16-bit integers).


Yes. WASM has proper integer and floating-point types.


And even JavaScript only conceptually uses doubles everywhere, JavaScript engines do use integers where they get away with it. Your loop counter is almost certainly an int. You can use this to your advantage for optimization purposes if you carefully craft your statements to probably fit in integers (e.g. by adding bitwise operations)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: