2 ms·
At least in rust, the fixed crate[0] is probably the standard for this. Personally I chose not to use it because integer generics in rust are not quite powerful
by jamesmunns 4y ago
At least in rust, the fixed crate[0] is probably the standard for this. Personally I chose not to use it because integer generics in rust are not quite powerful enough to express this without falling to type system hacks, at least in the stable version of the compiler.
However in C++, you might be able to mimic the API more clearly, as templating is able to do integer things that Rust can't yet easily today.
[0]: https://docs.rs/fixed/latest/fixed/ https://docs.rs/fixed/latest/fixed/