4 ms·
Does anyone know of a good fixed point library, preferably for C++? Fixed point seems straight forward enough that people tend to just roll their own, but it w
by martincmartin 4y ago
Does anyone know of a good fixed point library, preferably for C++? Fixed point seems straight forward enough that people tend to just roll their own, but it would be good to have a proper API to make the resulting code easier to read.
- jamesmunns 4y agoAt 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/