We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 19e7c12 + a8b82cd commit 24ef71cCopy full SHA for 24ef71c
xbrl/xbrl.py
@@ -660,10 +660,13 @@ def trim_decimals(s, precision=-3):
660
encoded = s.encode('ascii', 'ignore')
661
str_val = ""
662
if six.PY3:
663
- str_val = str(encoded, encoding='ascii',
664
- errors='ignore')[:precision]
+ str_val = str(encoded, encoding='ascii', errors='ignore')[:precision]
665
else:
666
- str_val = str(encoded)[:precision]
+ # If precision is 0, this must be handled seperately
+ if precision == 0:
667
+ str_val = str(encoded)
668
+ else:
669
+ str_val = str(encoded)[:precision]
670
if len(str_val) > 0:
671
return float(str_val)
672
0 commit comments