CGAL 5.1 - Number Types
Relates Rational

Classes

class  CGAL::Rational_traits< NT >
 

Functions

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

Function Documentation

◆ simplest_rational_in_interval()

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

#include <CGAL/simplest_rational_in_interval.h>

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()

◆ to_rational()

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

#include <CGAL/to_rational.h>

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()