- cross-posted to:
- programming@zerobytes.monster
- cross-posted to:
- programming@zerobytes.monster
Discussion on lobsters: https://lobste.rs/s/oxjvv0/0_1_0_2
It’s not that Roc only supports base-10 arithmetic. It also supports the typical base-2 floating-point numbers, because in many situations the performance benefits are absolutely worth the cost of precision loss. What sets Roc apart is its choice of default; when you write decimal literals like 0.1 or 0.2 in Roc, by default they’re represented by a 128-bit fixed-point base-10 number that never loses precision, making it reasonable to use for calculations involving money.
In Roc, floats are opt-in rather than opt-out.
Even more: