SF bug #1071566: moneyfmt recipe in decimal documentation has error
diff --git a/Doc/lib/libdecimal.tex b/Doc/lib/libdecimal.tex
index 5131ef9..7d461c2 100644
--- a/Doc/lib/libdecimal.tex
+++ b/Doc/lib/libdecimal.tex
@@ -993,6 +993,8 @@
'1.234.568-'
>>> moneyfmt(d, curr='$', neg='(', trailneg=')')
'($1,234,567.89)'
+ >>> moneyfmt(Decimal(123456))
+ '123,456.00'
"""
q = Decimal((0, (1,), -places)) # 2 places --> '0.01'
@@ -1009,7 +1011,7 @@
while digits:
build(next())
i += 1
- if i == 3:
+ if i == 3 and digits:
i = 0
build(sep)
build(curr)