Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/pool/doc/implementation/gcd_lcm.html @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 2.1 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
2<HTML>
3<HEAD>
4<TITLE>gcd_lcm - GCD and LCM</TITLE>
5<LINK HREF="../pool.css" REL="stylesheet" TYPE="text/css">
6</HEAD>
7<BODY>
8
9<IMG SRC="../../../../boost.png" WIDTH=276 HEIGHT=86 ALT="C++ Boost">
10
11<H1 ALIGN=CENTER>gcd_lcm - GCD and LCM</H1>
12
13<P>
14<H2>Introduction</H2>
15
16<P>
17detail/gcd_lcm.hpp provides two generic integer algorithms: greatest common divisor and least common multiple.
18
19<P>
20<H2>Synopsis</H2>
21<PRE CLASS="code">namespace details {
22namespace pool {
23
24template &lt;typename Integer&gt;
25Integer gcd(Integer A, Integer B);
26
27template &lt;typename Integer&gt;
28Integer lcm(Integer A, Integer B);
29
30} // namespace pool
31} // namespace details</PRE>
32
33<P>
34<H2>Semantics</H2>
35
36<TABLE ALIGN=CENTER BORDER>
37<CAPTION><EM>Symbol Table</EM></CAPTION>
38<TR><TH>Symbol<TH>Meaning</TR>
39<TR><TD CLASS="code">Integer<TD>An integral type</TR>
40<TR><TD CLASS="code">A, B<TD>Values of type <SPAN CLASS="code">Integer</SPAN></TR>
41</TABLE>
42
43<TABLE ALIGN=CENTER BORDER>
44<CAPTION><EM>Semantics</EM></CAPTION>
45<TR><TH>Expression<TH>Result Type<TH>Precondition<TH>Notes
46<TR><TD CLASS="code">gcd(A, B)<TD>Integer<TD CLASS="code">A &gt; 0 &amp;&amp; B &gt; 0<TD>Returns the greatest common divisor of <SPAN CLASS="code">A</SPAN> and <SPAN CLASS="code">B</SPAN>
47<TR><TD CLASS="code">lcm(A, B)<TD>Integer<TD CLASS="code">A &gt; 0 &amp;&amp; B &gt; 0<TD>Returns the least common multiple of <SPAN CLASS="code">A</SPAN> and <SPAN CLASS="code">B</SPAN>
48</TABLE>
49
50<P>
51<H2>Implementation Notes</H2>
52
53<P>
54For faster results, ensure <SPAN CLASS="code">A &gt; B</SPAN>
55
56<P>
57<H2>Dependencies</H2>
58
59<P>
60None.
61
62<P>
63<H2>Future Directions</H2>
64
65<P>
66This header may be replaced by a Boost algorithms library.
67
68<P>
69<HR>
70
71<P>
72Copyright &copy; 2000, 2001 Stephen Cleary (scleary AT jerviswebb DOT com)
73
74<P>
75This file can be redistributed and/or modified under the terms found in <A HREF="../copyright.html">copyright.html</A>
76
77<P>
78This software and its documentation is provided &quot;as is&quot; without express or implied warranty, and with no claim as to its suitability for any purpose.
79
80</BODY>
81</HTML>
Note: See TracBrowser for help on using the repository browser.