Message239498
I think that Decimal is not needed for Fraction.__format__ (and I'm not sure that issue23602v4.patch is correct). The correct way to format Fraction as fixed-precision decimal is to use Fraction.__round__() or similar algorithm. The implementation can look like:
f = self.__round__(prec)
i = int(f)
return '%d.%0*d' % (i, prec, abs(f - i) * 10**prec) |
|
| Date |
User |
Action |
Args |
| 2015-03-29 16:54:26 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, mark.dickinson, scoder, eric.smith, ezio.melotti, skrah, martin.panter, wolma, tuomas.suutari |
| 2015-03-29 16:54:26 | serhiy.storchaka | set | messageid: <[email protected]> |
| 2015-03-29 16:54:25 | serhiy.storchaka | link | issue23602 messages |
| 2015-03-29 16:54:25 | serhiy.storchaka | create | |
|