E.V.E
v2023.02.15

◆ exponent

eve::exponent = {}
inlineconstexpr

Computes the IEEE exponent of the floating value.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T >
eve::as_integer_t<T> exponent(T x) noexcept;
}
constexpr callable_exponent_ exponent
Computes the IEEE exponent of the floating value.
Definition: exponent.hpp:56
Definition: abi.hpp:18

Parameters

Return value

The value of the IEEE exponent is returned.

Note
  • 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[\).
  • The exception is when \(x = \pm0, \pm\infty\) or is a Nan, where \(m=x\) and \(e=0\)).

Example

#include <eve/module/core.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
Computes the IEEE NaN constant.
Definition: nan.hpp:53
constexpr callable_minf_ minf
Computes the -infinity ieee value.
Definition: minf.hpp:60
constexpr callable_mindenormal_ mindenormal
Computes the smallest denormal positive value.
Definition: mindenormal.hpp:59
constexpr callable_inf_ inf
Computes the infinity ieee value.
Definition: inf.hpp:58
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65