#include <iostream>
#include "DGtal/arithmetic/LighterSternBrocot.h"
Go to the source code of this file.
|
void | usage (int, char **argv) |
|
int | main (int argc, char **argv) |
|
- Author
- Jacques-Olivier Lachaud (
jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr
) Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
- Date
- 2012/02/06
An example file named fraction.
This file is part of the DGtal library.
Definition in file fraction.cpp.
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Main.
[fraction-types]
[fraction-types]
[fraction-from-quotients]
[fraction-from-quotients]
Definition at line 49 of file fraction.cpp.
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)
boost::int64_t int64_t
signed 94-bit integer.
References usage().
◆ usage()
void usage |
( |
int |
, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 40 of file fraction.cpp.
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;
Referenced by main().