Chris Rebert <c...@rebertia.com> wrote: > >>>> c = decimal.Context(prec=5) > >>>> decimal.Decimal(1234567).to_eng_string(c) > > '1234567' > > > > That is not an engineering notation string. > > Apparently either you and the General Decimal Arithmetic spec differ > on what constitutes engineering notation, there's a bug in the Python > decimal library, or you're hitting some obscure part of the spec's > definition. I don't have the expertise to know which is the case. > > The spec: http://speleotrove.com/decimal/decarith.pdf > (to-engineering-string is on page 20 if you're interested)
The module is correct. Printing without exponent follows the same rules as to-scientific-string: "If the exponent is less than or equal to zero and the adjusted exponent is greater than or equal to -6, the number will be converted to a character form without using exponential notation." Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list