cgal icon indicating copy to clipboard operation
cgal copied to clipboard

How to get resulted variables as 'double' type

Open zed654 opened this issue 5 years ago • 2 comments

How to get variables, s(0) ~ s(4), as double?

For example,,

double s0_tmp = *s.variable_numerators_begin(); double s1_tmp = *(s.variable_numerators_begin()+1); ...

It's not working.

( the type is ↓ typedef CGAL::Gmpzf ET; CGAL::Quadratic_program_solution < CGAL::Gmpzf > s = CGAL::solve_quadratic_program(qp, ET()); )

zed654 avatar Dec 13 '20 13:12 zed654

Use to_double().

Ex.

CGAL::Gmpzf tmp = *s.variable_numerators_begin(); double d_tmp = tmp.to_double(); std::cout << d_tmp << std::endl;

zed654 avatar Dec 13 '20 13:12 zed654

Use to_double().

Ex.

CGAL::Gmpzf tmp = *s.variable_numerators_begin(); double d_tmp = tmp.to_double(); std::cout << d_tmp << std::endl;

Thanks!!

zed654 avatar Dec 13 '20 13:12 zed654