Open littledan opened 4 years ago
I would love to see this working. Today I have a POC for financial app running on node.js that's using a npm package to deal with decimal and is far from usable. Having a native implementation or even a wasm implementation would be amazing. Actually it is almost impossible to deal with professional finance calcs in JS without something like that. btw, dec64 is a great idea.
It's a bit early to make a concrete proposal, but Decimal may make sense in WebAssembly as well. In Wasm, there could be two new scalar types, dec64 and dec128, which could be passed on the stack or read or written from the memory, and some new operations to manipulate them. If WebAssembly adds IEEE 64-bit and/or 128-bit decimal scalar types some day, then the WebAssembly/JS API could introduce conversions along the boundary, analogous to WebAssembly BigInt/i64 integration. WebAssembly Decimal support could enable Wasm engines to use hardware support or other kinds of platform-specific implementations (e.g., call out to optimized assembly routines) to make IEEE decimal calculations faster.