diff options
author | Constantine Evans <const@costi.eu> | 2022-02-09 01:25:10 +0000 |
---|---|---|
committer | Constantine Evans <const@costi.eu> | 2022-02-09 01:25:10 +0000 |
commit | c50074000fb31e3b2fd86988459d40f0d3cac497 (patch) | |
tree | d08f50fe38c7643c48e28e68a903040b63f6ffcf /CHANGES | |
parent | 5403f46ecf636d0749cf54cddf725d177d60af61 (diff) | |
download | pint-c50074000fb31e3b2fd86988459d40f0d3cac497.tar.gz |
Fix to_compact, infer_base_unit for non-float non_int_type (#1461)
to_compact used math.log10, which converted non-float types to floats;
this caused exceptions when using a non-integer type, like Decimal,
that does not implement multiplication/division with floats, and
generally changed non-integer types to floats. This addresses the
problem by checking non_int_type. If non_int_type != float, it
assumes that the type implements a log10 method, as Decimal does.
infer_base_unit created a generic UnitsContainer, not a UnitsContainer
specific to a registry; this allows specification of a registry, or
uses the registry of the passed-in Quantity/UnitLike.
Diffstat (limited to 'CHANGES')
-rw-r--r-- | CHANGES | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -16,6 +16,7 @@ Pint Changelog - Use default numpy `np.printoptions` available since numpy 1.15. - Implement `numpy.nanprod` (Issue #1369) - Fix default_format ignored for measurement (Issue #1456) +- Fix `to_compact` and `infer_base_unit` for non-float non_int_type. ### Breaking Changes |