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

◆ pi

auto eve::pi = functor<pi_t>
inlineconstexpr

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T >
T pi(as<T> x) noexcept;
}
constexpr auto pi
Callable object computing the constant .
Definition pi.hpp:77
EVE Main Namespace.
Definition abi.hpp:18
Lightweight type-wrapper.
Definition as.hpp:29

Parameters

  • x : Type wrapper instance embedding the type of the constant.

Return value

The call eve::pi(as<T>()) returns the constant \(\pi\).

Example

#include <eve/module/math.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_pi() { return eve::pi(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::setprecision(9) << std::endl
<< "-> pi(as<wide_ft>()) = " << eve::pi(eve::as<wide_ft>()) << std::endl
<< "-> pi(as(wxf)) = " << eve::pi(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> pi(as<float>()) = " << eve::pi(eve::as(float())) << std::endl
<< "-> pi(as<xf)) = " << eve::pi(eve::as(xf)) << std::endl;
std::cout << "-> constexpr pi = " << constexpr_pi<float>() << std::endl;
return 0;
}
Wrapper for SIMD registers.
Definition wide.hpp:86