You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to utilize fixed-point arithmetic in unit-safe code for a few reasons:
The code runs on microcontrollers which don't have floating-point hardware
I need to guarantee a certain minimum precision across a specific, limited range of values
Fixed-point is associative and free of accumulating errors, unlike floating point
(All of these relate to my use of mostly length and velocity quantities in CNC firmware and G-Code parsing, to provide some context)
I would like to use the popular fixed crate for fixed-point arithmetic. On a feature level, the types in this crate obviously support enough arithmetic for uom to work, but as noted elsewhere, due to the Conversion<V> implementation requirement it is extremely cumbersome to implement.
Note that resolving #122 would also solve this issue, since then it would be more feasible for me to implement the custom storage type myself.
The best current workaround is to use ISQ! with SI quantities, integer units of sufficient size, and SI prefixed units to increase the precision of the system. For instance, while in my case I would want to use 22.10 signed fixed point (32-bit values and a precision of ~100μm when using SI base units), I can emulate a close-enough precision by using micrometers and i32 storage type.
The text was updated successfully, but these errors were encountered:
I want to utilize fixed-point arithmetic in unit-safe code for a few reasons:
(All of these relate to my use of mostly length and velocity quantities in CNC firmware and G-Code parsing, to provide some context)
I would like to use the popular
fixed
crate for fixed-point arithmetic. On a feature level, the types in this crate obviously support enough arithmetic for uom to work, but as noted elsewhere, due to theConversion<V>
implementation requirement it is extremely cumbersome to implement.Note that resolving #122 would also solve this issue, since then it would be more feasible for me to implement the custom storage type myself.
The best current workaround is to use
ISQ!
with SI quantities, integer units of sufficient size, and SI prefixed units to increase the precision of the system. For instance, while in my case I would want to use 22.10 signed fixed point (32-bit values and a precision of ~100μm when using SI base units), I can emulate a close-enough precision by using micrometers and i32 storage type.The text was updated successfully, but these errors were encountered: