\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.8.1 - Number Types
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Relates Rational

Classes

class  CGAL::Rational_traits< NT >
 The class Rational_traits can be used to determine the type of the numerator and denominator of a rational number type as Quotient, Gmpq, mpq_class or leda_rational. More...
 

Functions

template<typename Rational >
Rational CGAL::simplest_rational_in_interval (double d1, double d2)
 computes the rational number with the smallest denominator in the interval [d1,d2]. More...
 
template<typename Rational >
Rational CGAL::to_rational (double d)
 computes the rational number that equals d. More...
 

Function Documentation

template<typename Rational >
Rational CGAL::simplest_rational_in_interval ( double  d1,
double  d2 
)

computes the rational number with the smallest denominator in the interval [d1,d2].

Computes the simplest rational number in an interval of two double values.

Implementation

See Knuth, "Seminumerical algorithms", page 654, answer to exercise 4.53-39.

See Also
CGAL::to_rational()

#include <CGAL/simplest_rational_in_interval.h>

template<typename Rational >
Rational CGAL::to_rational ( double  d)

computes the rational number that equals d.

Computes the rational number representing a given double precision floating point number.

See Also
CGAL::simplest_rational_in_interval()

#include <CGAL/to_rational.h>