◆ log()

IEEEValue boost::simd::log ( IEEEValue const &  x)

This function object returns the natural logarithm of its argument.

Header <boost/simd/function/log.hpp>
See also
log10, log2, log1p
Note:
  • log(x) return Nan for negative entries (peculiarly Mzero for floating numbers).
Decorators
  • std_ for floating entries calls std::log
Example:
#include <boost/simd/exponential.hpp>
#include <boost/simd/pack.hpp>
#include <iostream>
namespace bs = boost::simd;
using pack_ft = bs::pack<float, 4>;
int main() {
pack_ft pf = {1.0f, 2.0f, 1000.0f, 0.5f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bs::log(pf) = " << bs::log(pf) << '\n';
float xf = 2.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::log(xf) = " << bs::log(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, 1000, 0.5)
-> bs::log(pf) = (0, 0.693147, 6.90776, -0.693147)
---- scalar
<- xf = 2
-> bs::log(xf) = 0.693147