E.V.E
v2023.02.15

◆ log10

eve::log10 = {}
inlineconstexpr

Callable object computing the base 10 logarithm: \(\log_{10} x\).

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T >
T log10(T x) noexcept; //1
template< eve::floating_value T >
}
constexpr callable_log10_ log10
Callable object computing the base 10 logarithm: .
Definition: log10.hpp:89
Definition: abi.hpp:18
SIMD-compatible representation of complex numbers.
Definition: complex.hpp:39

Parameters

Return value

  1. Returns the elementwise the base 10 logarithm of x In particular, for floating inputs:
    • If the element is \(\pm0\), \(-\infty\) is returned.
    • If the element is \(1\), \(+0\) is returned.
    • If the element is \(\infty\), \(\infty\) is returned.
    • If the element is less than 0, NaN is returned.
  2. Returns elementwise the base 10 logarithm of the input The behavior of this function is equivalent to log(z)/log_10(as(x)).

Example

Real version

#include <eve/module/math.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, -0.0f, -1.0f, 1.0f, 2.0f,
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> log10(pf) = " << eve::log10(pf) << '\n'
;
float xf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> log10(xf) = " << eve::log10(xf) << '\n';
return 0;
}
constexpr callable_nan_ nan
Computes the IEEE NaN constant.
Definition: nan.hpp:53
constexpr callable_inf_ inf
Computes the infinity ieee value.
Definition: inf.hpp:58
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65

Complex version

#include <eve/module/complex.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft ref = { 0.0f, 1.0f, -1.0f, 0.5f};
wide_ft imf = { 2.0f , -1.0, -5.0, 0.0};
auto z = eve::as_complex_t<wide_ft>(ref, imf);
std::cout
<< "---- simd" << std::endl
<< "<- z = " << z << std::endl
<< "-> log10(z) = " << eve::log10(z) << std::endl;
return 0;
}

Semantic Modifiers

  • Masked Call

    The call eve::log10[mask](x) provides a masked version of eve::log10 which is equivalent to if_else (mask, log10(x), x).

    Example

    #include <eve/module/math.hpp>
    #include <eve/wide.hpp>
    #include <iostream>
    int main()
    {
    wide_ft pf = {0.0f, -0.0f, -1.0f, 1.0f, 2.0f,
    std::cout << "---- simd" << '\n'
    << "<- pf = " << pf << '\n'
    << "-> log10[pf > 1.0](pf) = " << eve::log10[pf > 1.0](pf) << '\n';
    return 0;
    }