On Mon, Mar 22, 2010 at 8:02 PM, Pierre B. <pierre...@hotmail.com> wrote: > Sorry to intervene out of the blue, but I find the suggested rule for > fractional to decimal conversion not as clean as I'd expect. > > If fractions are converted to decimals when doing arithmetics, would it be > worthwhile to at least provide a minimum of fractional conversion integrity? > What I have in mind is the following rule: > > When doing conversion from fraction to decimal, always generate a whole number > of repeating digits, always at least twice. > > Examples, with a precision of 5 in Decimal: > > 1/2 -> 0.50000 > > 1/3 -> 0.33333 > > 1/11 -> 0.090909 > # Note that we produced 6 digits, because > # the repeating pattern contains 2 digits. > > 1/7 -> 0.142857142857 > # Always at least two full patterns.
And for 1/123123127? The decimal expansion of this fraction has a period of over 15 million! Sorry, but this doesn't seem like a feasible or desirable strategy. Mark _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com