Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

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


Chronological Thread 
  • From: Khue Le <>
  • To:
  • Subject: Re: [cgal-discuss] How to convert Quotient to double?
  • Date: Tue, 26 Jan 2016 22:41:01 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:wVeGYhXlEgq8w9ZvOjLbmJ1tyzHV8LGtZVwlr6E/grcLSJyIuqrYZhCGt8tkgFKBZ4jH8fUM07OQ6PC/HzRYqs/b7jgrS99laVwssY0uhQsuAcqIWwXQDcXBSGgEJvlET0Jv5HqhMEJYS47UblzWpWCuv3ZJQk2sfTR8Kum9IIPOlcP/j7n0oM2MJV0Qz2PnP/tbF1afk0b4joEum4xsK6I8mFPig0BjXKBo/15uPk+ZhB3m5829r9ZJ+iVUvO89pYYbCf2pN/dwcbsNBzsvNyU55dbgqALYZQqJ/HoVFGsMwTRSBA2QzxHnU9/Vv2Outvdg1CiXO872UL1yXTmK4KJiSRuugyACYW1quFrLg9B92foI6CmqoAZyltbZ

I have got an answer: http://stackoverflow.com/questions/35023805/cgal-convert-quotient-to-double?noredirect=1#comment57775154_35023805

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

On Tue, Jan 26, 2016 at 10:04 PM, Khue Le <> wrote:
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