On 2022-12-17, Chris Angelico <ros...@gmail.com> wrote: >> It was the rounding rounding error that I needed to avoid (as Peter >> J. Holzer suggested). The use of decimal solved it and just in >> time. I was about to truncate the number, get each of the >> characters from the string mantissa, and then do something like >> this: >> >> 64550.727 >> >> 64550 + (7 * 0.1) + (2 * 0.01) + (7 * 0.001) >> >> Now I do not need to! > > It sounds like fixed-point arithmetic might be a better fit for what > you're doing.
Yes, fixed point (or decimal) is a better fit for what he's doing. but I suspect that floating point would be a better fit for the problem he's trying to solve. -- Grant -- https://mail.python.org/mailman/listinfo/python-list