mirror of
https://github.com/boostorg/interval.git
synced 2026-01-25 18:22:20 +00:00
94 lines
4.0 KiB
HTML
94 lines
4.0 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
"http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
|
|
<title>Tests and Examples</title>
|
|
</head>
|
|
|
|
<body lang="en">
|
|
<h1>Tests and Examples</h1>
|
|
|
|
<p>In <code>libs/interval/test/</code> and
|
|
<code>libs/interval/examples/</code> are some test and example programs.. The
|
|
examples illustrate a few uses of intervals. For a general description and
|
|
considerations on using this library, and some potential domains of
|
|
application, please read this <a href="guide.htm">mini-guide</a>.</p>
|
|
|
|
<h2>Tests</h2>
|
|
|
|
<p>The test programs are as follows. Please note that they require the use of
|
|
the Boost.test library and can be automatically tested by using
|
|
<code>bjam</code> (except for interval_test.cpp).</p>
|
|
|
|
<p><b>add.cpp</b> tests if the additive and substractive operators and the
|
|
respective _std and _opp rounding functions are correctly implemented. It is
|
|
done by using symbolic expressions as a base type.</p>
|
|
|
|
<p><b>cmp.cpp</b> and <b>cmp_lex.cpp</b> test if the operators
|
|
<code><</code> <code>></code> <code><=</code> <code>>=</code>
|
|
<code>==</code> <code>!=</code> behave correctly for the default comparison
|
|
and the lexicographic comparison. <b>cmp_exp.cpp</b> tests the explicit
|
|
comparison functions <code>cer..</code> and <code>pos..</code> behave
|
|
correctly. All these tests use some simple intervals ([1,2] and [3,4], [1,3]
|
|
and [2,4], [1,2] and [2,3], etc).</p>
|
|
|
|
<p><b>det.cpp</b> tests if the <code>_std</code> and <code>_opp</code>
|
|
versions in protected and unprotected mode produce the same result when Gauss
|
|
scheme is used on an unstable matrix (in order to exercise rounding). The
|
|
tests are done for <code>interval<float></code> and
|
|
<code>interval<double></code>.</p>
|
|
|
|
<p><b>fmod.cpp</b> defines a minimalistic version of
|
|
<code>interval<int></code> and uses it in order to test
|
|
<code>fmod</code> on some specific interval values.</p>
|
|
|
|
<p><b>mul.cpp</b> exercices the multiplication, the finite division, the
|
|
square and the square root with some integer intervals leading to exact
|
|
results.</p>
|
|
|
|
<p><b>pi.cpp</b> tests if the interval value of π (for
|
|
<code>int</code>, <code>float</code> and <code>double</code> base types)
|
|
contains the number π (defined with 21 decimal digits) and if it is a
|
|
subset of [π±1ulp] (in order to ensure some precision).</p>
|
|
|
|
<p><b>pow.cpp</b> tests if the <code>pow</code> function behaves correctly on
|
|
some simple test cases.</p>
|
|
|
|
<p><strong>test_float.cpp</strong> exercises the arithmetic operations of the
|
|
library for floating point base types.</p>
|
|
|
|
<p><b>interval_test.cpp</b> tests if the interval library respects the
|
|
inclusion property of interval arithmetic by computing some functions and
|
|
operations for both <code>double</code> and
|
|
<code>interval<double></code>.</p>
|
|
|
|
<h2>Examples</h2>
|
|
|
|
<p><b>findroot_demo.cpp</b> finds zeros of some functions by using dichotomy
|
|
and even produces gnuplot datas for one of them. The processor has to
|
|
correctly handle elementary functions for this example to properly work.</p>
|
|
|
|
<p><b>horner.cpp</b> is a really basic example of unprotecting the interval
|
|
operations for a whole function (which computes the value of a polynomial by
|
|
using Horner scheme).</p>
|
|
|
|
<p><b>newton-raphson.cpp</b> is a (bad) implementation of a specialized
|
|
version of Newton-Raphson algorithm for finding the zeros of a function
|
|
knowing its derivative. It exercises unprotecting, full division, some set
|
|
operations and empty intervals.</p>
|
|
|
|
<p><b>interval_speed.cpp</b> is not really an example but more like a
|
|
benchmark for testing performance of the library. It needs to be compiled
|
|
with <code>-DUSE_BOOST</code>. The compilation option
|
|
<code>-DUSE_BOOST_UNPROTECTED</code> allows the program to use unprotected
|
|
local rounding, leading to better performance.</p>
|
|
<hr>
|
|
|
|
<p>Revised: 2002-12-15<br>
|
|
Copyright (c) Guillaume Melquiond, Sylvain Pion, Hervé Brönnimann, 2002.<br>
|
|
Polytechnic University.</p>
|
|
</body>
|
|
</html>
|