piranha  0.10
Public Types | Public Member Functions | List of all members
piranha::math::binomial_impl< T, U, binomial_fp_arith_enabler< T, U > > Struct Template Reference

Specialisation of the implementation of piranha::math::binomial() for floating-point and arithmetic arguments. More...

#include <piranha/binomial.hpp>

Public Types

using result_type = typename std::common_type< T, U >::type
 Result type for the call operator. More...
 

Public Member Functions

result_type operator() (const T &x, const U &y) const
 Call operator. More...
 

Detailed Description

template<typename T, typename U>
struct piranha::math::binomial_impl< T, U, binomial_fp_arith_enabler< T, U > >

Specialisation of the implementation of piranha::math::binomial() for floating-point and arithmetic arguments.

This specialisation is activated when both arguments are C++ arithmetic types and at least one argument is a floating-point type.

Definition at line 149 of file binomial.hpp.

Member Typedef Documentation

◆ result_type

template<typename T , typename U >
using piranha::math::binomial_impl< T, U, binomial_fp_arith_enabler< T, U > >::result_type = typename std::common_type<T, U>::type

Result type for the call operator.

The result type is the widest floating-point type among T and U.

Definition at line 154 of file binomial.hpp.

Member Function Documentation

◆ operator()()

template<typename T , typename U >
result_type piranha::math::binomial_impl< T, U, binomial_fp_arith_enabler< T, U > >::operator() ( const T &  x,
const U &  y 
) const
inline

Call operator.

The implementation, accepting any real finite value for x and y, is described in http://arxiv.org/abs/1105.3689/. Note that, since the implementation uses floating-point arithmetics, the result will - in general - be inexact, even if both x and y represent integral values.

Parameters
xtop argument.
ybottom argument.
Returns
x choose y.
Exceptions
std::invalid_argumentif at least one argument is not finite.

Definition at line 169 of file binomial.hpp.


The documentation for this struct was generated from the following file: