31 #include "DGtal/arithmetic/LighterSternBrocot.h"
36 using namespace DGtal;
42 std::cerr <<
"Usage: " << argv[ 0 ] <<
" <u_0> <u_1> ... <u_k>" << std::endl;
43 std::cerr <<
"\t - computes the fraction [u_0; u_1, ..., u_k] from its partial quotients." << std::endl;
49 int main(
int argc,
char** argv )
61 typedef SB::Fraction Fraction;
62 typedef std::back_insert_iterator< Fraction > OutputIterator;
67 OutputIterator itback = std::back_inserter( f );
68 for ( Quotient i = 1; i < argc; ++i)
70 Quotient u = atoll( argv[ i ] );
71 *itback++ = std::make_pair( u, i-1 );
73 std::cout <<
"z = " << f.p() <<
" / " << f.q() << std::endl;
Aim: The Stern-Brocot tree is the tree of irreducible fractions. This class allows to construct it pr...
Point::Coordinate Integer
void usage(int, char **argv)
int main(int argc, char **argv)
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::int64_t int64_t
signed 94-bit integer.