E.V.E  0.1-beta

◆ exponent

eve::exponent = {}
inlineconstexpr

Callable object computing the exponent value.

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

Members Functions

Member Effect
operator() the computation of the exponent value
operator[] Construct a conditional version of current function object

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

Parameters

x: floating_real_value.

Return value

Computes the elementwise ieee exponent of the floating value.

The exponent \(e\) and mantissa \(m\) of a floating point entry \(x\) are related by \(x = m\times 2^e\), with \(|m| \in [1, 2[\). (except for \(x = \pm0, \pm\infty\) or is a Nan, where \(m=x\) and \(e=0\)).


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

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

Parameters

cond : conditional expression

Return value

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


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/exponent.hpp>
#include <eve/constant/inf.hpp>
#include <eve/constant/minf.hpp>
#include <eve/constant/nan.hpp>
#include <eve/constant/mindenormal.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {-1.0f, 0.0f, 367.0f, -1005600.0f, eve::mindenormal(eve::as<float>()),
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> exponent(pf) = " << eve::exponent(pf) << '\n';
float xf = -32768.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> exponent(xf) = " << eve::exponent(xf) << '\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 callable_exponent_ exponent
Callable object computing the exponent value.
Definition: exponent.hpp:76
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65