]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <html> |
2 | <head> | |
3 | <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> | |
4 | <title>Prime Numbers</title> | |
5 | <link rel="stylesheet" href="../../math.css" type="text/css"> | |
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> | |
7 | <link rel="home" href="../../index.html" title="Math Toolkit 2.5.1"> | |
8 | <link rel="up" href="../number_series.html" title="Number Series"> | |
9 | <link rel="prev" href="tangent_numbers.html" title="Tangent Numbers"> | |
10 | <link rel="next" href="../sf_gamma.html" title="Gamma Functions"> | |
11 | </head> | |
12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> | |
13 | <table cellpadding="2" width="100%"><tr> | |
14 | <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> | |
15 | <td align="center"><a href="../../../../../../index.html">Home</a></td> | |
16 | <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> | |
17 | <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> | |
18 | <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> | |
19 | <td align="center"><a href="../../../../../../more/index.htm">More</a></td> | |
20 | </tr></table> | |
21 | <hr> | |
22 | <div class="spirit-nav"> | |
23 | <a accesskey="p" href="tangent_numbers.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../number_series.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../sf_gamma.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> | |
24 | </div> | |
25 | <div class="section"> | |
26 | <div class="titlepage"><div><div><h3 class="title"> | |
27 | <a name="math_toolkit.number_series.primes"></a><a class="link" href="primes.html" title="Prime Numbers">Prime Numbers</a> | |
28 | </h3></div></div></div> | |
29 | <h5> | |
30 | <a name="math_toolkit.number_series.primes.h0"></a> | |
31 | <span class="phrase"><a name="math_toolkit.number_series.primes.synopsis"></a></span><a class="link" href="primes.html#math_toolkit.number_series.primes.synopsis">Synopsis</a> | |
32 | </h5> | |
33 | <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">prime</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> | |
34 | </pre> | |
35 | <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span> <span class="special">{</span> | |
36 | ||
37 | <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Policy</span><span class="special">></span> | |
38 | <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint32_t</span> <span class="identifier">prime</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Policy</span><span class="special">&</span> <span class="identifier">pol</span><span class="special">);</span> | |
39 | ||
40 | <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint32_t</span> <span class="identifier">prime</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">);</span> | |
41 | ||
42 | <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="identifier">max_prime</span> <span class="special">=</span> <span class="number">10000</span><span class="special">;</span> | |
43 | ||
44 | <span class="special">}}</span> <span class="comment">// namespaces</span> | |
45 | </pre> | |
46 | <h5> | |
47 | <a name="math_toolkit.number_series.primes.h1"></a> | |
48 | <span class="phrase"><a name="math_toolkit.number_series.primes.description"></a></span><a class="link" href="primes.html#math_toolkit.number_series.primes.description">Description</a> | |
49 | </h5> | |
50 | <p> | |
51 | The function <code class="computeroutput"><span class="identifier">prime</span></code> provides | |
52 | fast table lookup to the first 10000 prime numbers (starting from 2 as the | |
53 | zeroth prime: as 1 isn't terribly useful in practice). There are two function | |
54 | signatures one of which takes an optional <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a> | |
55 | as the second parameter to control error handling. | |
56 | </p> | |
57 | <p> | |
58 | The constant <code class="computeroutput"><span class="identifier">max_prime</span></code> is | |
59 | the largest value you can pass to <code class="computeroutput"><span class="identifier">prime</span></code> | |
60 | without incurring an error. | |
61 | </p> | |
62 | <p> | |
63 | Passing a value greater than <code class="computeroutput"><span class="identifier">max_prime</span></code> | |
64 | results in a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a> | |
65 | being raised. | |
66 | </p> | |
67 | </div> | |
68 | <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> | |
69 | <td align="left"></td> | |
70 | <td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal, | |
71 | Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert | |
72 | Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan Råde, Gautam Sewani, | |
73 | Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p> | |
74 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
75 | file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) | |
76 | </p> | |
77 | </div></td> | |
78 | </tr></table> | |
79 | <hr> | |
80 | <div class="spirit-nav"> | |
81 | <a accesskey="p" href="tangent_numbers.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../number_series.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../sf_gamma.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> | |
82 | </div> | |
83 | </body> | |
84 | </html> |