Dependence on Decimal has been eliminated for all classes. High-precision types are now optionally supported via high_precision arguments passed at init time and to most free methods.
This solution is not perfect. It requires client code to be careful about being consistent when passing numeric types - passing a float value as an argument to any one of numerous classes or methods is likely to raise an exception if high-precision types are also being used. It also clutters up the code by requiring that high_precision be passed around just about everywhere. It also (unnecessarily) converts int values to high-precision types.
Even so, this revision is an improvement - it works, has simplified testing considerably, and recognizes that native floating-point precision should generally be sufficient for this application.
In the long run, it is likely preferable to treat high-precision mode as a contextual setting, managed via contextvars, as suggested in this comment. But that can be left to a future issue.
Dependence on
Decimal
has been eliminated for all classes. High-precision types are now optionally supported viahigh_precision
arguments passed at init time and to most free methods.This solution is not perfect. It requires client code to be careful about being consistent when passing numeric types - passing a
float
value as an argument to any one of numerous classes or methods is likely to raise an exception if high-precision types are also being used. It also clutters up the code by requiring thathigh_precision
be passed around just about everywhere. It also (unnecessarily) convertsint
values to high-precision types.Even so, this revision is an improvement - it works, has simplified testing considerably, and recognizes that native floating-point precision should generally be sufficient for this application.
In the long run, it is likely preferable to treat high-precision mode as a contextual setting, managed via
contextvars
, as suggested in this comment. But that can be left to a future issue.Closes #77.