|
inlineconstexpr |
Computes the square of the parameter.
Defined in Header
Parameters
Return value
value containing the elementwise square of x
if it is representable in this type.
eve::saturated(eve::abs)(x)
is greater than eve::Sqrtvalmax(as(x))
the corresponding element result is undefined.Masked Call
The call eve;sqr[mask](x)
provides a masked version of eve::sqr
which is equivalent to if_else (mask, sqr(x), x)
.
Example
The call eve::saturated(eve::sqr)(x)
computes a saturated version of eve::sqr.
Contrary to the non-decorated case, it guarantees that the result is elementwise greater or equal than 0. More specifically, for any signed integer value x
, the expression:
saturated(sqr)(x)
evaluates to:
`eve::valmax(as(x))` as soon as eve::saturated(eve::abs)(x)
is greater than eve::sqrtvalmax(as(x))
.
Example