Complex Numbers

Fractions are worse than both floating-point and fixed-point numbers is almost every way. Most importantly:

  • If you don't round results, in computations that aren't designed to work out just so, the size of the numerator and denominator is exponential in the number of terms in the computation.
  • If you do round results, the result will generally be significantly less accurate than what you would get with an equivalently-sized fixed- or floating-point representation, because rationals are not uniformly spaced and have redundant representations.

The are legitimately useful for some computational geometry operations where the number of terms involved is tightly bounded, but those computations can also just be rephrased in terms of integers, so you don't really need a rational type to implement them.

They're also real good at representing 1/3 exactly, which seems appealing, but has more psychological benefit than anything else.

7 Likes