E.V.E  0.1-beta

◆ ifrexp

eve::ifrexp = {}
inlineconstexpr

Callable object computing the ifrexp pair of values.

Required header: #include <eve/function/ifrexp.hpp>

Members Functions

Member Effect
operator() the computation of the ifrexp pair of values

auto operator()(floating_value auto x) const noexcept;
Definition: value.hpp:83

Parameters

x: floating_real_value.

Return value

Computes the elementwise ieee ifrexp of the floating value, returning a pair {m,e} of values m being of the same type as x and e of the asscociated integral type, which are related by \(x = m\times 2^e\), with \(|m| \in [0.5, 1.5[\).

However, the cases \(x = \pm\infty\) or is a Nan or a denormal are undefined.


auto operator[]( conditional_expression auto cond ) const noexcept;

Higher-order function generating a masked version of eve::ifrexp

Parameters

cond : conditional expression

Return value

A Callable object so that the expression ifrexp[cond](x, ...) is equivalent to if_else(cond,ifrexp(x, ...),x)


Supported decorators

  • eve::pedantic

    Required header: #include <eve/function/pedantic/ifrexp.hpp>

    The call pedantic(ifrexp)(x) takes also properly care of the cases where \(x = \pm0, \pm\infty\) or is a Nan, where \(m=x\) and \(e=0\) and of the denormal cases.

Example

See it live on Compiler Explorer

#include <eve/function/ifrexp.hpp>
#include <eve/function/pedantic/ifrexp.hpp>
#include <eve/wide.hpp>
#include <eve/constant/mindenormal.hpp>
#include <eve/constant/minf.hpp>
#include <eve/constant/inf.hpp>
#include <eve/constant/nan.hpp>
#include <iostream>
int main()
{
wide_ft pf = {-1.0f, 0.0f, 367.0f, -1005600.0f, eve::mindenormal(eve::as<double>()),
auto [m, e] = eve::ifrexp(pf);
auto [mp, ep] = eve::pedantic(eve::ifrexp)(pf);
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> ifrexp(pf) = [" << '\n'
<< " " << m << ", \n"
<< " " << e << '\n'
<< " ]\n"
<< "-> pedantic(ifrexp)(pf) = [" << '\n'
<< " " << mp << ", \n"
<< " " << ep << '\n'
<< " ]\n";
float xf = 2.3;
auto [sm, se] = eve::ifrexp(xf);
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> ifrexp(xf) = [" << sm << ", " << se << "]\n";
return 0;
}
constexpr callable_nan_ nan
Callable object computing the nan value.
Definition: nan.hpp:52
constexpr callable_minf_ minf
Callable object computing the negative infinity value.
Definition: minf.hpp:55
constexpr callable_mindenormal_ mindenormal
Callable object computing the least denormal positive value.
Definition: mindenormal.hpp:56
constexpr callable_inf_ inf
Callable object computing the infinity ieee value.
Definition: inf.hpp:54
constexpr pedantic_type const pedantic
Higher-order Callable Object imbuing more standard semantic onto other Callable Objects.
Definition: pedantic.hpp:56
constexpr callable_ifrexp_ ifrexp
Callable object computing the ifrexp pair of values.
Definition: ifrexp.hpp:85
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65