New issue 205: amounts smaller than 1E-6 are incorrectly handled (scientific notation instead of decimal)
https://bitbucket.org/blais/beancount/issues/205/amounts-smaller-than-1e-6-are-incorrectly
Markus Teufelberger:
See the following test case(s):
```
#!python
$ python3
Python 3.6.3 (default, Oct 24 2017, 14:48:20)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from beancount.core.number import D
>>> D("0.1")
Decimal('0.1')
>>> D("0.01")
Decimal('0.01')
>>> D("0.001")
Decimal('0.001')
>>> D("0.0001")
Decimal('0.0001')
>>> D("0.00001")
Decimal('0.00001')
>>> D("0.000001")
Decimal('0.000001')
>>> D("0.0000001")
Decimal('1E-7')
>>> D("0.00000001")
Decimal('1E-8')
```
This is an issue for me, because I want to import data from Bitcoin into Beancount. While the 8 digit precision of BTC compared to the 2 digits of USD is not an issue in general, any transaction that is smaller than 1 millionth of a BTC breaks the generated file, because it is written in scientific notation by Beancount. This causes errors like `syntax error, unexpected CURRENCY, expecting EOL or COMMENT or ATAT or AT` (in case someone googles that one) because instead of `Assets:Foo 0.00000001 BTC` something like `Assets:Foo 1E-8 BTC` is written by the importer instead.
The relevant code seems to be in the to_string() function in core amount.