piranha  0.10
piranha::math::pow_impl< T, U, math_rational_pow_enabler< T, U > > Struct Template Reference

Specialisation of the implementation of piranha::math::pow() for piranha::mp_rational. More...

#include <piranha/mp_rational.hpp>

## Public Member Functions

ret_type operator() (const T &b, const U &e) const
Call operator. More...

## Detailed Description

### template<typename T, typename U> struct piranha::math::pow_impl< T, U, math_rational_pow_enabler< T, U > >

Specialisation of the implementation of piranha::math::pow() for piranha::mp_rational.

This specialisation is activated when one of the arguments is piranha::mp_rational and the other is either piranha::mp_rational or an interoperable type for piranha::mp_rational.

The implementation follows these rules:

• if the base is rational and the exponent an integral type or piranha::mp_integer, then piranha::mp_rational::pow() is used;
• if the non-rational argument is a floating-point type, then the rational argument is converted to that floating-point type and piranha::math::pow() is used;
• if both arguments are rational the result will be rational and the success of the operation depends on the values of the operands;
• if the base is an integral type or piranha::mp_integer and the exponent a rational, the result is computed via the integral–integer specialisation of piranha::math::pow() and the the success of the operation depends on the values of the operands.

Definition at line 1934 of file mp_rational.hpp.

## ◆ operator()()

template<typename T , typename U >
 ret_type piranha::math::pow_impl< T, U, math_rational_pow_enabler< T, U > >::operator() ( const T & b, const U & e ) const
inline

Call operator.

Parameters
 b base. e exponent.
Returns
b**e.
Exceptions
 std::invalid_argument if the result cannot be computed. unspecified any exception thrown by: piranha::math::pow(), piranha::mp_rational::pow(), converting piranha::mp_rational to a floating-point type.

Definition at line 2017 of file mp_rational.hpp.

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