E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ significants

auto eve::significants = functor<significants_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
constexpr auto significants(auto floating_value x, auto value n) noexcept;
}
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:116
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition value.hpp:34
constexpr auto significants
Computes the rounding to n significants digits of the first input.
Definition significants.hpp:68
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

Computes elementwise the rounding to n significants digits of x. With null n the result is a NaN.

Warning
Floating numbers are not stored in decimal form. So if you try significants with a not exactly representable number the result can be not exactly what you expect.

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
#include <iomanip>
int main()
{
eve::wide qi = {0, 1, 2, 3, 4, 5, 6, 7};
float pf = 1.2345678901f;
std::cout << std::setprecision(10);
std::cout << "<- pf = " << pf << "\n";
std::cout << "<- qi = " << qi << "\n";
std::cout << "-> significants(pf, qi)= " << eve::significants(pf, qi) << "\n";
}
Wrapper for SIMD registers.
Definition wide.hpp:70