3 ms·
The main operation I can think of is multiplying by a ratio without losing precision. If all your values are specified in 64-bit fixed point, a 128-bit integer
by 0xcde4c3db 10y ago
The main operation I can think of is multiplying by a ratio without losing precision. If all your values are specified in 64-bit fixed point, a 128-bit integer type gives you something with enough bits for the intermediate product. It's not something I've really dealt with myself, but I seem to remember reading that this is really handy to have in some physics simulations and control system algorithms that do numerical integration. At any rate, it's important enough that many Forth dialects have a word for this specific operation [1].
[1] https://www.forth.com/starting-forth/5-fixed-point-arithmetic/#Star-slash_the_Scalar https://www.forth.com/starting-forth/5-fixed-point-arithmeti...
- astrobe_ 10y agoOr more generally fixed point with big numbers and lots of decimals.
- Someone 10y agoThat's less of a concern for 64-bit (even for signed arithmetic, intermediary results can be close to 1.0E19) than for the typical 16-bit values and intermediary 32-bit result that Forth was designed for. It also is a lot less of a concern on modern systems, where floating point operations aren't much slower than integer ones.