Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/math/special_functions/sinhc_test.hpp @ 12

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

added boost

File size: 2.1 KB
Line 
1// unit test file sinhc.hpp for the special functions test suite
2
3//  (C) Copyright Hubert Holin 2003.
4//  Distributed under the Boost Software License, Version 1.0. (See
5//  accompanying file LICENSE_1_0.txt or copy at
6//  http://www.boost.org/LICENSE_1_0.txt)
7
8
9#include <functional>
10#include <iomanip>
11#include <iostream>
12#include <complex>
13
14
15#include <boost/math/special_functions/sinhc.hpp>
16
17
18#include <boost/test/unit_test.hpp>
19
20
21BOOST_TEST_CASE_TEMPLATE_FUNCTION(sinhc_pi_test, T)
22{
23    using    ::std::abs;
24       
25    using    ::std::numeric_limits;
26   
27    using    ::boost::math::sinhc_pi;
28   
29   
30    BOOST_MESSAGE("Testing sinhc_pi in the real domain for "
31        << string_type_name<T>::_() << ".");
32   
33    BOOST_CHECK_PREDICATE(::std::less_equal<T>(),
34        (abs(sinhc_pi<T>(static_cast<T>(0))-static_cast<T>(1)))
35        (numeric_limits<T>::epsilon()));
36}
37
38
39BOOST_TEST_CASE_TEMPLATE_FUNCTION(sinhc_pi_complex_test, T)
40{
41    using    ::std::abs;
42    using    ::std::sin;
43       
44    using    ::std::numeric_limits;
45   
46    using    ::boost::math::sinhc_pi;
47   
48   
49    BOOST_MESSAGE("Testing sinhc_pi in the complex domain for "
50        << string_type_name<T>::_() << ".");
51   
52    BOOST_CHECK_PREDICATE(::std::less_equal<T>(),
53        (abs(sinhc_pi<T>(::std::complex<T>(0, 1))-
54             ::std::complex<T>(sin(static_cast<T>(1)))))
55        (numeric_limits<T>::epsilon()));
56}
57
58
59void    sinhc_pi_manual_check()
60{
61    using    ::boost::math::sinhc_pi;
62   
63   
64    BOOST_MESSAGE(" ");
65    BOOST_MESSAGE("sinc_pi");
66   
67    for    (int i = 0; i <= 100; i++)
68    {
69        BOOST_MESSAGE( ::std::setw(15)
70                    << sinhc_pi<float>(static_cast<float>(i-50)/
71                                                static_cast<float>(50))
72                    << ::std::setw(15)
73                    << sinhc_pi<double>(static_cast<double>(i-50)/
74                                                static_cast<double>(50))
75                    << ::std::setw(15)
76                    << sinhc_pi<long double>(static_cast<long double>(i-50)/
77                                                static_cast<long double>(50)));
78    }
79   
80    BOOST_MESSAGE(" ");
81}
82   
83
Note: See TracBrowser for help on using the repository browser.