V8 + dynamic language + better math support = perfect environment for many applications out there
V8 + dynamic language + better math support = perfect environment for many applications out there
You might miss out on some SIMD operations, but you'd be able to do 90% of what you'd want with scientific calcs. (admittedly, it'd be nice if this were part of the language).
I’ve only worked on probability applications at a surface level for a tiny bit and never really needed it, but I kept wondering whether there were such a numeric types, and if not, what people did if they needed it.
Log odds ratios are also good representations that have this kind of accuracy between zero and one. They're good when you need them. (e.g. 100:1 odds are log(100/1) and 1:100 odds are log(1/100))
The handy functions are more about making sure that cancellations don't happen by providing a few primitive operations that cover lots of the uses. Like the handy log1p which computes log(1+x). If you did this with the log function, you'll compute log(1+1e-200)=log(1)=0. If you use log1p, you get log1p(1e-200)=1e-200. You avoid the loss of info that comes with adding something close to zero to something that isn't close to zero, which is the real trick. And then if you need something close to one, you probable just use the converse: instead of using p=1-eps, you just work with eps itself.
Is there a better way?
Yours is probably more space efficient though.
IEEE 754, BTW, allows for 10-based floats, but IDK if anybody uses it.
Is it just a matter of there being a "blessed" implementation for folks to standardize around?
Support for this I believe is "low level enough" to ve implemented natively, it's not something like protobuf.