File: test_tgamma_eh.cpp

package info (click to toggle)
scipy 1.17.0-1exp2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 235,340 kB
  • sloc: cpp: 506,914; python: 357,038; ansic: 215,028; javascript: 89,566; fortran: 19,308; cs: 3,081; f90: 1,150; sh: 860; makefile: 519; pascal: 284; lisp: 134; xml: 56; perl: 51
file content (23 lines) | stat: -rw-r--r-- 956 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//  (C) Copyright John Maddock 2024.
//  Use, modification and distribution are subject to the
//  Boost Software License, Version 1.0. (See accompanying file
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false

#include "math_unit_test.hpp"
#include <cfenv>
#include <iostream>
#include <boost/math/special_functions/gamma.hpp>


int main()
{
   CHECK_EQUAL(boost::math::tgamma(-200.5), 0.0); // triggers internal exception handling
   CHECK_EQUAL(boost::math::gamma_p(500.125, 1e-50), 0.0); // triggers internal exception handling

   // Lines that can only be hit when promotion to 80-bit reals is turned off
   CHECK_ULP_CLOSE(boost::math::tgamma(44.0, 0.000001), 6.04152630633738356373551320685139975072645120000000000000000e52, 10);
   CHECK_ULP_CLOSE(boost::math::gamma_p(1.0001, boost::math::gamma_p_inv(1.0001, 1e-200)), 1e-200, 10);
   return boost::math::test::report_errors();
}