Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] how to convert "rational" value to other formats?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] how to convert "rational" value to other formats?


Chronological Thread 
  • From: Michael Hemmer <>
  • To: "" <>
  • Subject: Re: [cgal-discuss] how to convert "rational" value to other formats?
  • Date: Thu, 06 Mar 2008 15:49:11 +0100

Mahmood Naderan wrote:

Hello,
How it is possible to convert a rational value to float or double or integer?
In other word, I want something like "Alg_point_2 <-- Rat_point_2".

There is CGAL::to_double which converts a number into double. (see also CGAL::To_interval)

In case you want to convert to Integer you can use CGAL::Fraction_traits<Rational>. The traits can decompose a type and provides the correct Numerator and Denominator type.
Supported types are CORE::BigRat, leda::rational, Gmpq and others.


Michael


  • Re: [cgal-discuss] how to convert "rational" value to other formats?, Michael Hemmer, 03/06/2008

Archive powered by MHonArc 2.6.16.

Top of Page