I am using boost multiprecision library floating point number. I need to map a gmp_float
to an tanh
and then take it as a double because value of tanh
will be [0, 1)
. When I use convert_to<double>()
I get compilation error as shown in the snippet bellow.
typedef boost::multiprecision::number<boost::multiprecision::gmp_float<4>> float_type;
float_type previous_v = agent->_velocity(i, j);
float_type sigmapped_v = boost::multiprecision::tanh(previous_v);
double sigmoid_velocity = sigmapped_v.convert_to<double>();
// expected primary-expression before ‘double’ ^^
double v_probable = abs(sigmoid_velocity);
However explicitly casting it to double (double)sigmapped_v
works