On Sat, 17 Oct 2026 02:28:10 -0000 (UTC) Lawrence D’Oliveiro <l…@nz.invalid> wrote:
> > IMHO one of the biggest programming mistakes is using floating point > > when you can do it faster, more accurately, and more easily with > > integers.
> > Some languages offer direct support for “fixed-point” formats, > basically integers with a fixed scale factor, so you can do > calculations that keep a fractional part. > > From what I gather, they tend to be difficult to use properly. The > problem seems to be keeping calculations within the permissible > dynamic range, to avoid overflow and underflow. > > This is why floating-point tends to be far more popular.
Yep. You can do fixed-point/scaled-integer math even in languages with- out a dedicated type if you put your mind to it (it's very common with Forth people,) but no matter how you do it one of the challenges is being *actually* sure that your calculations won't exceed the bounds set for range and precision by your choice of word size and scaling factor. Floating-point saves you the trouble of doing that, but as has been discussed it has its own set of quirks to be accounted for.