Listen to a clear birdsong.
esv::abs calculates an absolute value of a mathematical real value. That is, if the value < 0, return -value, else return value.
Return type is the same as the type of value.
constexpr auto abs_value = esv::abs(value);
Return type is the same as the type of value.
constexpr auto abs_value = esv::abs.fn(value);
Return type is always return_type .
For example,
esv::abs.fn<esv::fx64>(-2.55)
returns 2.55 ;
esv::abs.fn<esv::fx64>(-2)
returns 2.0 ;
constexpr auto abs_value = esv::abs.fn<return_type>(value);
Return type is return_type, arg type is arg_type.
For example,
esv::abs.fn<esv::fx64, esv::i64>(-2.55)
returns 2.0 ;
esv::abs.fn<esv::fx64>(-2)
returns 2.0 ;
constexpr auto abs_value = esv::abs.fn<return_type, arg_type>(value);
arg value => return value:
#include <esvcpp/core.hpp> #include <esvcpp/math.hpp> int main() { for (esv::ix32 i=-4; i<=4; ++i) esv::print(esv::abs(i)); }