E.V.E  0.1-beta

◆ ceil

eve::ceil = {}
inlineconstexpr

Callable object computing the ceil operation.

Required header: #include <eve/function/ceil.hpp>

Members Functions

Member Effect
operator() the ceil operation
operator[] Construct a conditional version of current function object

template< value T > auto operator()( T x ) const noexcept;

Parameters

x: value.

Return value

Computes elementwise the smallest integer not less than x.


auto operator[]( conditional_expression auto cond ) const noexcept;

Higher-order function generating a masked version of eve::ceil

Parameters

cond : conditional expression

Return value

A Callable object so that the expression ceil[cond](x, ...) is equivalent to if_else(cond,ceil(x, ...),x)


Supported decorators

  • eve::tolerant

    Required header: #include <eve/function/tolerant/ceil.hpp>

    The expression tolerant(ceil)(x, tol) computes a tolerant ceil value for x, where x must be a floating value.

    • If tol is a floating_value computes the floor with a tolerance tol using Hagerty's FL5 function.
    • If tol is an integral_value n compute the floor of the next nth representable value in the x type.
    • If tol is omitted the tolerance is taken to 3 times the machine \(\epsilon\) in the x type (3*eps(as(x))).
  • eve::diff, eve::diff_1st, eve::diff_nth

    Required header: #include <eve/function/diff/ceil.hpp>

    The expression diff(ceil)(x) computes the derivative of the function at x.

Example

See it live on Compiler Explorer

#include <eve/function/ceil.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {-1.0f, -1.3f, -1.5f, -1.7f, 2.0f, 2.3f, 2.5f, 2.7f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> ceil(pf) = " << eve::ceil(pf) << '\n';
float xf = -32.768f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> ceil(xf) = " << eve::ceil(xf) << '\n';
return 0;
}
constexpr callable_ceil_ ceil
Callable object computing the ceil operation.
Definition: ceil.hpp:86
Wrapper for SIMD registers.
Definition: wide.hpp:65