E.V.E
v2022.03.00

◆ frexp

eve::frexp = {}
inlineconstexpr

Computes the elementwise ieee pair of mantissa and exponent of the floating value,.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T >
kumi::tuple<T, T> frexp(T x) noexcept;
}
constexpr callable_frexp_ frexp
Computes the elementwise ieee pair of mantissa and exponent of the floating value,...
Definition: frexp.hpp:74
Definition: all_of.hpp:22

Parameters

Return value

Computes the elementwise ieee frexp of the floating value, returning a pair {m,e} of values of the same type asx`, 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.

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<double>()),
auto [m, e] = eve::frexp(pf);
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> frexp(pf) = [" << '\n'
<< " " << m << ", \n"
<< " " << e << '\n'
<< " ]\n";
float xf = 2.3;
auto [sm, se] = eve::frexp(xf);
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> frexp(xf) = [" << sm << ", " << se << "]\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:95
constexpr callable_mindenormal_ mindenormal
Computes the smallest denormal positive value.
Definition: mindenormal.hpp:96
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

Semantic Modifiers