MCPcopy Index your code
hub / github.com/python/cpython / to_eng_string

Method to_eng_string

Lib/_pydecimal.py:1037–1044  ·  view source on GitHub ↗

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, context=None)

Source from the content-addressed store, hash-verified

1035 return sign + intpart + fracpart + exp
1036
1037 def to_eng_string(self, context=None):
1038 """Convert to a string, using engineering notation if an exponent is needed.
1039
1040 Engineering notation has an exponent which is a multiple of 3. This
1041 can leave up to 3 digits to the left of the decimal place and may
1042 require the addition of either one or two trailing zeros.
1043 """
1044 return self.__str__(eng=True, context=context)
1045
1046 def __neg__(self, context=None):
1047 """Returns a copy with the sign switched.

Callers 5

test_none_argsMethod · 0.95
to_eng_stringMethod · 0.45
test_named_parametersMethod · 0.45
test_c_funcsMethod · 0.45
verifyFunction · 0.45

Calls 1

__str__Method · 0.95

Tested by 3

test_none_argsMethod · 0.76
test_named_parametersMethod · 0.36
test_c_funcsMethod · 0.36