MCPcopy Create free account
hub / github.com/apache/fory / decimal_from_parts

Function decimal_from_parts

python/pyfory/tests/xlang_test_main.py:57–60  ·  view source on GitHub ↗
(unscaled: int, scale: int)

Source from the content-addressed store, hash-verified

55
56
57def decimal_from_parts(unscaled: int, scale: int) -> decimal.Decimal:
58 sign = 1 if unscaled < 0 else 0
59 digits = tuple(int(ch) for ch in str(abs(unscaled))) if unscaled else (0,)
60 return decimal.Decimal((sign, digits, -scale))
61
62
63def decimal_values() -> List[decimal.Decimal]:

Callers 1

decimal_valuesFunction · 0.85

Calls 1

DecimalMethod · 0.45

Tested by

no test coverage detected