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

◆ phi

auto eve::phi = functor<phi_t>
inlineconstexpr

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T >
T phi(as<T> x) noexcept;
}
constexpr auto phi
Callable object computing the golden ratio : .
Definition phi.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::phi(as<T>()) returns the golden ratio.

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_phi() { return eve::phi(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::setprecision(9) << std::endl
<< "-> phi(as<wide_ft>()) = " << eve::phi(eve::as<wide_ft>()) << std::endl
<< "-> phi(as(wxf)) = " << eve::phi(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> phi(as<float>()) = " << eve::phi(eve::as(float())) << std::endl
<< "-> phi(as<xf)) = " << eve::phi(eve::as(xf)) << std::endl;
std::cout << "-> constexpr phi = " << constexpr_phi<float>() << std::endl;
return 0;
}
Wrapper for SIMD registers.
Definition wide.hpp:70