yunruse / Noether

Just another units package
MIT License
9 stars 0 forks source link

Measure._basis to reduce stored floating point error #58

Open yunruse opened 1 year ago

yunruse commented 1 year ago

Feature suggestion

Some issues, like #18, will always be subject to floating-point error due to the nature of a degree being irrational number of radians. This is a more general symptom of a wider issue — when treating with non-SI units, Noether still implicitly stores the value in SI.

It could potentially be useful if a ._basis: Unit | None property was added that, if present, provides a context unit for ._value and ._stddev.

For example, degree(30) would now be represented similarly to (30, degree) rather than (0.523598..., radian).

yunruse commented 1 year ago

I like the idea of this, but I am worried it is slightly-out-of-scope. For now at least I'll remove it from 1.0.1 milestone, as #18 is fixed

yunruse commented 5 months ago

I think it might help if such a ._basis operated exactly similar to the display catalogues we have - rather than a new "unit basis" for every measure, we have a single one we can point to or even change entirely. By default it's SI, of course.