On Sat, 18 Feb 2023 at 12:41, Greg Ewing via Python-list <python-list@python.org> wrote: > > On 18/02/23 7:42 am, Richard Damon wrote: > > On 2/17/23 5:27 AM, Stephen Tucker wrote: > >> None of the digits in RootNZZZ's string should be different from the > >> corresponding digits in RootN. > > > > Only if the storage format was DECIMAL. > > Note that using decimal wouldn't eliminate this particular problem, > since 1/3 isn't exactly representable in decimal either. > > To avoid it you would need to use an algorithm that computes nth > roots directly rather than raising to the power 1/n. >
It's somewhat curious that we don't really have that. We have many other inverse operations - addition and subtraction (not just "negate and add"), multiplication and division, log and exp - but we have exponentiation without an arbitrary-root operation. For square roots, that's not a problem, since we can precisely express the concept "raise to the 0.5th power", but for anything else, we have to raise to a fractional power that might be imprecise. But maybe, in practice, this isn't even a problem? ChrisA -- https://mail.python.org/mailman/listinfo/python-list