diff --git a/src/core/include/mp-units/framework/representation_concepts.h b/src/core/include/mp-units/framework/representation_concepts.h index 3afda421..414c0875 100644 --- a/src/core/include/mp-units/framework/representation_concepts.h +++ b/src/core/include/mp-units/framework/representation_concepts.h @@ -208,7 +208,11 @@ struct magnitude_t { else if constexpr (requires { abs(vec); }) return abs(vec); else if constexpr (std::is_arithmetic_v && (!is_same_v)) +#if MP_UNITS_HOSTED || __cpp_lib_freestanding_cstdlib >= 202306L return std::abs(vec); +#else + return vec >= 0 ? vec : -vec; +#endif } } };