Convert to a string, using engineering notation if an exponent is needed. Engineering notation has an exponent which is a multiple of 3. This can leave up to 3 digits to the left of the decimal place and may require the addition of either one or two trailing zeros.
(self, a)
| 5528 | return r |
| 5529 | |
| 5530 | def to_eng_string(self, a): |
| 5531 | """Convert to a string, using engineering notation if an exponent is needed. |
| 5532 | |
| 5533 | Engineering notation has an exponent which is a multiple of 3. This |
| 5534 | can leave up to 3 digits to the left of the decimal place and may |
| 5535 | require the addition of either one or two trailing zeros. |
| 5536 | |
| 5537 | The operation is not affected by the context. |
| 5538 | |
| 5539 | >>> ExtendedContext.to_eng_string(Decimal('123E+1')) |
| 5540 | '1.23E+3' |
| 5541 | >>> ExtendedContext.to_eng_string(Decimal('123E+3')) |
| 5542 | '123E+3' |
| 5543 | >>> ExtendedContext.to_eng_string(Decimal('123E-10')) |
| 5544 | '12.3E-9' |
| 5545 | >>> ExtendedContext.to_eng_string(Decimal('-123E-12')) |
| 5546 | '-123E-12' |
| 5547 | >>> ExtendedContext.to_eng_string(Decimal('7E-7')) |
| 5548 | '700E-9' |
| 5549 | >>> ExtendedContext.to_eng_string(Decimal('7E+1')) |
| 5550 | '70' |
| 5551 | >>> ExtendedContext.to_eng_string(Decimal('0E+1')) |
| 5552 | '0.00E+3' |
| 5553 | |
| 5554 | """ |
| 5555 | a = _convert_other(a, raiseit=True) |
| 5556 | return a.to_eng_string(context=self) |
| 5557 | |
| 5558 | def to_sci_string(self, a): |
| 5559 | """Converts a number to a string, using scientific notation. |
nothing calls this directly
no test coverage detected