Hacker News new | ask | show | jobs
by pps43 3080 days ago
That's easy, always round down and also carry max possible error (calculated by rounding up and subtracting the rounded down value). For example, 1/3 can be represented as 0.333 with error 0.001. Multiply it by 3 and get 0.999 with error 0.003.

You won't need many bits for the error, and operations can be made reasonably fast as only several lowest bits are affected.