26#if ! defined (octave_lo_mappers_h)
27#define octave_lo_mappers_h 1
29#include "octave-config.h"
51inline double copysign (
double x,
double y) {
return std::copysign (
x, y); }
52inline float copysign (
float x,
float y) {
return std::copysignf (
x, y); }
54inline double signbit (
double x) {
return std::signbit (
x); }
55inline float signbit (
float x) {
return std::signbit (
x); }
76inline double conj (
double x) {
return x; }
77inline float conj (
float x) {
return x; }
86inline double log2 (
double x) {
return std::log2 (
x); }
87inline float log2 (
float x) {
return std::log2f (
x); }
98inline double exp2 (
double x) {
return std::exp2 (
x); }
99inline float exp2 (
float x) {
return std::exp2f (
x); }
105 return std::complex<T> (std::ceil (std::real (
x)),
106 std::ceil (std::imag (
x)));
113 return std::complex<T> (std::trunc (std::real (
x)),
114 std::trunc (std::imag (
x)));
118inline double fix (
double x) {
return std::trunc (
x); }
119inline float fix (
float x) {
return std::trunc (
x); }
132 return std::complex<T> (std::floor (std::real (
x)),
133 std::floor (std::imag (
x)));
136inline double round (
double x) {
return std::round (
x); }
137inline float round (
float x) {
return std::roundf (
x); }
143 return std::complex<T> (
round (std::real (
x)),
round (std::imag (
x)));
151 if (fabs (
x - t) == 0.5)
152 t = 2 * std::trunc (0.5 * t);
162 if (fabsf (
x - t) == 0.5f)
163 t = 2 * std::trunc (0.5f * t);
172 return std::complex<T> (
roundb (std::real (
x)),
roundb (std::imag (
x)));
178inline bool isnan (
bool) {
return false; }
179inline bool isnan (
char) {
return false; }
181inline bool isnan (
double x) {
return std::isnan (
x); }
182inline bool isnan (
float x) {
return std::isnan (
x); }
189 return (
isnan (std::real (
x)) ||
isnan (std::imag (
x)));
203inline bool isinf (
double x) {
return std::isinf (
x); }
204inline bool isinf (
float x) {
return std::isinf (
x); }
218 return (
isinf (std::real (
x)) ||
isinf (std::imag (
x)));
238 return isnan (
x) ? numeric_limits<double>::NaN () : tmp;
251 return isnan (
x) ? numeric_limits<float>::NaN () : tmp;
260 return tmp == 0 ? 0.0 :
x / tmp;
306 < std::numeric_limits<T>::epsilon ()))
310 T n = std::floor (q);
319 if (
x != y && y != 0)
332 retval = numeric_limits<T>::NaN ();
339 < std::numeric_limits<T>::epsilon ()))
343 T n = std::trunc (q);
352 if (
x != y && y != 0)
363 return x <= y ?
x : y;
370 return x >= y ?
x : y;
380 return isnan (y) ?
x : (
x <= y ?
x : y);
386 return isnan (y) ?
x : (
x >= y ?
x : y);
392 return isnan (y) ?
x : (
x <= y ?
x : y);
398 return isnan (y) ?
x : (
x >= y ?
x : y);
401inline std::complex<double>
402min (
const std::complex<double>&
x,
const std::complex<double>& y)
407inline std::complex<float>
408min (
const std::complex<float>&
x,
const std::complex<float>& y)
413inline std::complex<double>
414max (
const std::complex<double>&
x,
const std::complex<double>& y)
419inline std::complex<float>
420max (
const std::complex<float>&
x,
const std::complex<float>& y)
465OCTAVE_END_NAMESPACE(math)
466OCTAVE_END_NAMESPACE(octave)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
std::complex< T > ceil(const std::complex< T > &x)
Complex atan(const Complex &x)
bool is_NaN_or_NA(const Complex &x)
std::complex< T > floor(const std::complex< T > &x)
Complex asin(const Complex &x)
bool positive_sign(double x)
octave_idx_type nint_big(double x)
bool negative_sign(double x)
double copysign(double x, double y)
Complex acos(const Complex &x)
std::complex< T > trunc(const std::complex< T > &x)
double frexp(double x, int *expptr)
F77_RET_T const F77_DBLE * x
std::complex< double > Complex
std::complex< float > FloatComplex
octave_int< T > xmin(const octave_int< T > &x, const octave_int< T > &y)
octave_int< T > xmax(const octave_int< T > &x, const octave_int< T > &y)
template int8_t abs(int8_t)