Luke Valenty
Luke Valenty
There are a bunch of locations where compound statements are requirements of concepts, they would almost all need to be removed to support safe-arithmetic. I didn't point them all out...
What is the absolute minimum set of requirements for numerical values for them to work as expected with mp-units? Do these requirements belong on `Quantity`, or can they be split...
> Looks to me that the correct result for you example would be [0, 100) - range 0 - 99. Would you like to verify this? Yes, 0 - 99...
Maybe it will take a few days 😅
Here's an algorithm that appears to work so far with some testing I've done. There's a lot to it: https://stackoverflow.com/questions/31057473/calculating-the-modulo-of-two-intervals
> Here's an algorithm that appears to work so far with some testing I've done. There's a lot to it: > > https://stackoverflow.com/questions/31057473/calculating-the-modulo-of-two-intervals This algorithm also has bugs. It gives...
Whelp, there's another wrinkle here. Python says `50 % -200 == -150`, but C++ says `50 % -150 == 50`. https://godbolt.org/z/vYvP8M1rb So the `%` operator in C++ isn't actually modulo,...
Unfortunately this can't be done for most operators. safe::var operators typically return types that are not the same as either of the operands.
Some notes on how this might work. ```c++ safe::var current_speed = 100_s32 * km / h; constexpr auto speed_limit = 100_s32 * km / h; ``` ```c++ units::some_type current_speed =...
another variation of the top that does a better job satisfying the DRY principle: ```c++ auto current_speed = s32_ival{100_s32} * km / h; ```