E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
diff_of_prod
auto eve::diff_of_prod =
functor
<diff_of_prod_t>
inline
constexpr
Header file
#include <eve/module/core.hpp>
Callable Signatures
namespace
eve
{
// Regular overload
constexpr
auto
diff_of_prod
(
floating_value
auto
x,
floating_value
auto
y,
floating_value
auto
z,
floating_value
auto
t)
noexcept
;
// 1
// Lanes masking
constexpr
auto
diff_of_prod
[
conditional_expr
auto
c](
floating_value
auto
x,
floating_value
auto
y,
floating_value
auto
z,
floating_value
auto
t)
noexcept
;
// 2
// Semantic exclusive options
constexpr
auto
diff_of_prod
[
raw
](
floating_value
auto
x,
floating_value
auto
y,
floating_value
auto
z,
floating_value
auto
t)
noexcept
;
// 3
constexpr
auto
diff_of_prod
[
pedantic
](
floating_value
auto
x,
floating_value
auto
y,
floating_value
auto
z,
floating_value
auto
t)
noexcept
;
// 4
}
eve::conditional_expr
Specifies that a type is a Conditional Expression.
Definition
conditional.hpp:28
eve::floating_value
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition
value.hpp:116
eve::diff_of_prod
constexpr auto diff_of_prod
elementwise_callable object computing the difference of products operation with better accuracy than ...
Definition
diff_of_prod.hpp:84
eve::raw
constexpr auto raw
Performs the operation minimally, trading accuracy for speed.
Definition
core.hpp:95
eve::pedantic
constexpr auto pedantic
Follows the corner cases of the corresponding standard function.
Definition
core.hpp:91
eve
EVE Main Namespace.
Definition
abi.hpp:19
Parameters
x
,
y
,
z
,
t
:
floating values
.
c
:
Conditional expression
masking the operation.
m
:
Logical value
masking the operation.
Return value
The value of
x*y-z*t
, with better precision if correct fma is available, is returned.
The operation is performed conditionally
.
computes a raw version of diff_of_prod, i.e. the naive formula (in fact
fms(x, y, z*t)
)
computes a pedantic version of
diff_of_prod
ensuring better accuracy in any case.
Example
// revision 0
#include <eve/module/core.hpp>
#include <iostream>
int
main()
{
eve::wide
wf0 = {3, 2, 1, 0};
eve::wide
wf1 = {4, 1, 2, 100};
eve::wide
wf2 = wf0+4*
eve::eps
(
eve::as<float>
());
eve::wide
wf3 = wf1-4*
eve::eps
(
eve::as<float>
());
std::cout <<
"<- wf0 = "
<< wf0 <<
"\n"
;
std::cout <<
"<- wf1 = "
<< wf1 <<
"\n"
;
std::cout <<
"<- wf2 = "
<< wf2 <<
"\n"
;
std::cout <<
"<- wf3 = "
<< wf3 <<
"\n"
;
std::cout <<
"-> diff_of_prod(wf0, wf1, wf2, wf3) = "
<<
eve::diff_of_prod
(wf0, wf1, wf2, wf3) <<
"\n"
;
std::cout <<
"-> diff_of_prod[ignore_last(2)](wf0, wf1, wf2, wf3) = "
<<
eve::diff_of_prod
[
eve::ignore_last
(2)](wf0, wf1, wf2, wf3) <<
"\n"
;
std::cout <<
"-> diff_of_prod[raw](wf0, wf1, wf2, wf3) = "
<<
eve::diff_of_prod
[
eve::raw
](wf0, wf1, wf2, wf3) <<
"\n"
;
std::cout <<
"-> diff_of_prod[pedantic](wf0, wf1, wf2, wf3) = "
<<
eve::diff_of_prod
[
eve::pedantic
](wf0, wf1, wf2, wf3) <<
"\n"
;
}
eve::eps
constexpr auto eps
Computes a constant to the machine epsilon.
Definition
eps.hpp:74
eve::as
Lightweight type-wrapper.
Definition
as.hpp:29
eve::ignore_last
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition
conditional.hpp:361
eve::wide
Wrapper for SIMD registers.
Definition
wide.hpp:94
eve