24 #if !defined (octave_lo_mappers_h)
25 #define octave_lo_mappers_h 1
33 extern OCTAVE_API
double xtrunc (
double x);
34 extern OCTAVE_API
double xcopysign (
double x,
double y);
36 extern OCTAVE_API
double xfloor (
double x);
37 inline double arg (
double x) {
return atan2 (0.0, x); }
38 inline double conj (
double x) {
return x; }
40 inline double imag (
double) {
return 0.0; }
41 inline double real (
double x) {
return x; }
42 extern OCTAVE_API
double xround (
double x);
43 extern OCTAVE_API
double xroundb (
double x);
44 extern OCTAVE_API
double signum (
double x);
45 extern OCTAVE_API
double xlog2 (
double x);
47 extern OCTAVE_API
double xlog2 (
double x,
int& exp);
49 extern OCTAVE_API
double xexp2 (
double x);
52 inline bool xisnan (
bool) {
return false; }
53 inline bool xisnan (
char) {
return false; }
55 #if defined (HAVE_CMATH_ISNAN)
57 {
return std::isnan (x); }
59 extern OCTAVE_API
bool xisnan (
double x);
61 #if defined (HAVE_CMATH_ISFINITE)
63 {
return std::isfinite (x); }
65 extern OCTAVE_API
bool xfinite (
double x);
67 #if defined (HAVE_CMATH_ISINF)
69 {
return std::isinf (x); }
71 extern OCTAVE_API
bool xisinf (
double x);
81 return x <= y ? x : y;
87 return x >= y ? x : y;
96 return xisnan (y) ? x : (x <= y ? x : y);
102 return xisnan (y) ? x : (x >= y ? x : y);
119 extern OCTAVE_API
float xtrunc (
float x);
120 extern OCTAVE_API
float xcopysign (
float x,
float y);
121 inline float xceil (
float x) {
return ceilf (x); }
122 extern OCTAVE_API
float xfloor (
float x);
123 inline float arg (
float x) {
return atan2f (0.0
f, x); }
124 inline float conj (
float x) {
return x; }
126 inline float imag (
float) {
return 0.0f; }
127 inline float real (
float x) {
return x; }
128 extern OCTAVE_API
float xround (
float x);
129 extern OCTAVE_API
float xroundb (
float x);
130 extern OCTAVE_API
float signum (
float x);
131 extern OCTAVE_API
float xlog2 (
float x);
133 extern OCTAVE_API
float xlog2 (
float x,
int& exp);
135 extern OCTAVE_API
float xexp2 (
float x);
137 #if defined (HAVE_CMATH_ISNANF)
139 {
return std::isnan (x); }
141 extern OCTAVE_API
bool xisnan (
float x);
143 #if defined (HAVE_CMATH_ISFINITEF)
145 {
return std::isfinite (x); }
147 extern OCTAVE_API
bool xfinite (
float x);
149 #if defined (HAVE_CMATH_ISINFF)
151 {
return std::isinf (x); }
153 extern OCTAVE_API
bool xisinf (
float x);
162 return xisnan (y) ? x : (x <= y ? x : y);
168 return xisnan (y) ? x : (x >= y ? x : y);
232 extern OCTAVE_API
int NINT (
double x);
233 extern OCTAVE_API
int NINT (
float x);
235 template <
typename T>
247 template <
typename T>
254 template <
typename T>
261 template <
typename T>
268 template <
typename T>
275 template <
typename T>
282 template <
typename T>
289 template <
typename T>
296 template <
typename T>
303 template <
typename T>
309 return tmp == 0 ? 0.0 : x / tmp;
312 template <
typename T>
332 if (x >= -1 && x <= 1)
335 < std::numeric_limits<T>::epsilon ())
341 < std::numeric_limits<T>::epsilon ())
348 volatile T tmp = y * n;
353 if (x != y && y != 0 && retval != 0)
359 template <
typename T>
379 if (x >= -1 && x <= 1)
382 < std::numeric_limits<T>::epsilon ())
388 < std::numeric_limits<T>::epsilon ())
395 volatile T tmp = y * n;
400 if (x != y && y != 0 && retval != 0)
406 template <
typename T>