Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] How to convert Quotient to double?

Subject: CGAL users discussion list

List archive

[cgal-discuss] How to convert Quotient to double?


Chronological Thread 
  • From: Khue Le <>
  • To:
  • Subject: [cgal-discuss] How to convert Quotient to double?
  • Date: Tue, 26 Jan 2016 22:04:36 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:5+7yHRf7Z6c+emPdcfG7Dfk7lGMj4u6mDksu8pMizoh2WeGdxc6+ZR7h7PlgxGXEQZ/co6odzbGG7Oa4ASdZu87JmUtBWaIPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4bt74BpTVx5zukbvipNuLO04R3mL1SIgxBSv1hD2ZjtMRj4pmJ/R54TryiVwMRd5rw3h1L0mYhRf265T41pdi9yNNp6BprJYYAu2pN5g/GLdXBTBjP2Eu79DwrjHCSxGO7z0SSDY4iB1NVivF8Ryyepq55ivnq+Z81S+ZPdD7C7Q5cTun5qZvDhTvjXFUZHYC7GjLh5ko3+pgqxW7qkknzg==

Hello,

I am using CGAL QP solver for my project, and get stuck at a numerical issue when getting the objective value:

typedef CGAL::Gmpzf ET;
...define a quadratic program qp here...
Solution s = CGAL::solve_quadratic_program(qp, ET());
assert (s.solves_quadratic_program(qp));
cout<<"QP objective = "<<s.objective_value()<<endl;
// The above returns a value of type CGAL::Quotient<ET>
// and I need to convert it to double
double n = s.objective_value_numerator().to_double();
double d = s.objective_value_denominator().to_double();
cout<<"QP objective 2 = "<<n/d<<endl;
With the above code, I got:

QP objective = -2.57497e-22/2.01459e-22 
QP objective 2 = -nan
Clearly I failed on the conversion step. 
Could you please suggest me a way to properly do the conversion?

Thank you very much in advance!

Regards,

Khue Le
(Lê Hữu Điền Khuê)
PhD Student in Applied Mathematics,
Center for Visual Computing,
Ecole Centrale Paris
Grande Voie des Vignes, 92 295 Châtenay-Malabry, France



Archive powered by MHonArc 2.6.18.

Top of Page