Skip to content

Completely align the API of BigDecimal with Python's Decimal #175

@forfudan

Description

@forfudan

Currently, many methods in Python's Decimal type is not yet implemented in decimo.BigDecimal type. It would be nice that we implement all of them so that Pythonistas can smoothly call these methods.

Below is a summary of all methods of Python's Decimal and whether they are implemented in decimo.BigDecimal. Some of them have already been implemented but with different names, e.g., BigDecimal.exponent() is just Python's decimal.adjusted.

✓ __abs__          ✓ __add__          ✓ __bool__         ✓ __ceil__
✗ __complex__      ✓ __eq__           ✓ __float__        ✓ __floor__
✓ __floordiv__     ✓ __ge__           ✓ __gt__           ✗ __hash__
✓ __int__          ✓ __le__           ✓ __lt__           ✓ __mod__
✓ __mul__          ✓ __ne__           ✓ __neg__          ✓ __pos__
✓ __pow__          ✓ __radd__         ✓ __repr__         ✓ __rfloordiv__
✓ __rmod__         ✓ __rmul__         ✓ __round__        ✓ __rpow__
✓ __rsub__         ✓ __rtruediv__     ✓ __str__          ✓ __sub__
✓ __truediv__      ✓ __trunc__
✓ adjusted         ✗ as_integer_ratio ✓ as_tuple         ✗ canonical
✓ compare          ✗ conjugate        ✗ copy_abs         ✗ copy_negate
✗ copy_sign        ✓ exp              ✗ fma              ✗ is_canonical
✗ is_finite        ✓ is_integer       ✗ is_nan           ✗ is_normal
✗ is_signed        ✗ is_snan          ✗ is_subnormal     ✗ is_qnan
✓ ln               ✓ log10            ✗ logb             ✗ logical_and
✗ logical_invert   ✗ logical_or       ✗ logical_xor      ✓ max
✗ max_mag          ✓ min              ✗ min_mag          ✗ next_minus
✗ next_plus        ✗ next_toward      ✓ normalize        ✗ number_class
✓ quantize         ✗ radix            ✗ remainder_near   ✗ rotate
✗ same_quantum     ✗ scaleb           ✗ shift            ✓ sqrt
✓ to_eng_string    ✗ to_integral_exact ✗ to_integral_value

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions