This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients eric.smith, ezio.melotti, mark.dickinson, martin.panter, rhettinger, scoder, serhiy.storchaka, skrah, tuomas.suutari, wolma
Date 2015-03-29.17:40:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <[email protected]>
In-reply-to
Content
Or, speaking of "division with remainder":

    n, r = divmod(nom * 10**prec, den)
    if r * 5 >= den:
        n += 1
    x = str(n)
    print('%s.%s' % (x[:-prec], x[-prec:]))

... minus the usual off-by-one that the tests would quickly find :)
History
Date User Action Args
2015-03-29 17:40:47scodersetrecipients: + scoder, rhettinger, mark.dickinson, eric.smith, ezio.melotti, skrah, martin.panter, serhiy.storchaka, wolma, tuomas.suutari
2015-03-29 17:40:47scodersetmessageid: <[email protected]>
2015-03-29 17:40:47scoderlinkissue23602 messages
2015-03-29 17:40:47scodercreate