This has been on my mind for a while now. Previously, the .factor attribute was held as a float which meant that precision was lost every time that factor attributes were combined/reduced through multiplication/division. Eventually, this ended up in issues like #41.
Now, all .factor attributes are stored as fractions.Fraction. While this dramatically increases precision and the ability to carry defined units through a calculation it does not work consistently for all values in .factor. Notably, inches will correctly render, generally, for even powers of inches when raised to a power (e.g. si.inch**4). si.inch**3 will not be recognized as cubic inches because of a floating point error that creeps when performing the necessary cube root.
This has been on my mind for a while now. Previously, the .factor attribute was held as a float which meant that precision was lost every time that factor attributes were combined/reduced through multiplication/division. Eventually, this ended up in issues like #41.
Now, all .factor attributes are stored as
fractions.Fraction
. While this dramatically increases precision and the ability to carry defined units through a calculation it does not work consistently for all values in.factor
. Notably, inches will correctly render, generally, for even powers of inches when raised to a power (e.g.si.inch**4
).si.inch**3
will not be recognized as cubic inches because of a floating point error that creeps when performing the necessary cube root.