Mercurial > octave
diff liboctave/util/lo-ieee.h @ 23622:0abe8d85ecce
Use isnan, isinf, isfinite, signbit functions from C++ std lib.
These functions are guaranteed to be part of the std lib since
C++11 which is now a requirement of Octave.
* configure.ac: Remove OCTAVE_CHECK_FUNC_CMATH checks for isnan, isinf,
isfinite, signbit. Remove AC_CHECK_FUNCS tests for finite, isnan, isinf,
signbit, _finite, _isnan. Remove AC_CHECK_DECLS test for signbit.
* acinclude.m4 (OCTAVE_CHECK_FUNC_CMATH) : Remove unused macro.
* lo-mappers.cc (isnan, isfinite, isinf): Change functions to delegate to
std::FUNCTION of the same name rather than possibly calling lo_ieee_FUNCTION.
* lo-ieee.h: Add #include <cmath>.
* lo-ieee.h (__lo_ieee_isnan, __lo_ieee_finite, __lo_ieee_isinf,
__lo_ieee_signbit, __lo_ieee_float_isnan, __lo_ieee_float_finite,
__lo_ieee_float_isinf, __lo_ieee_float_signbit):
Change functions to delegate to std::FUNCTION of the same name.
* lo-ieee.cc (__lo_ieee_isnan, __lo_ieee_finite, __lo_ieee_isinf,
__lo_ieee_signbit, __lo_ieee_float_isnan, __lo_ieee_float_finite,
__lo_ieee_float_isinf, __lo_ieee_float_signbit):
Delete functions.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 16 Jun 2017 15:51:29 -0700 |
parents | 092078913d54 |
children | 194eb4bd202b |
line wrap: on
line diff
--- a/liboctave/util/lo-ieee.h Fri Jun 16 13:23:47 2017 -0700 +++ b/liboctave/util/lo-ieee.h Fri Jun 16 15:51:29 2017 -0700 @@ -23,6 +23,8 @@ #if ! defined (octave_lo_ieee_h) #define octave_lo_ieee_h 1 +#include <cmath> + #include "octave-config.h" #if defined (__cplusplus) @@ -70,9 +72,9 @@ extern OCTAVE_API void octave_ieee_init (void); -extern OCTAVE_API int __lo_ieee_isnan (double x); -extern OCTAVE_API int __lo_ieee_finite (double x); -extern OCTAVE_API int __lo_ieee_isinf (double x); +inline int __lo_ieee_isnan (double x) { return std::isnan (x); } +inline int __lo_ieee_finite (double x) { return std::isfinite (x); } +inline int __lo_ieee_isinf (double x) { return std::isinf (x); } extern OCTAVE_API int __lo_ieee_is_NA (double); extern OCTAVE_API int __lo_ieee_is_old_NA (double); @@ -82,11 +84,11 @@ extern OCTAVE_API double lo_ieee_na_value (void); extern OCTAVE_API double lo_ieee_nan_value (void); -extern OCTAVE_API int __lo_ieee_signbit (double); +inline int __lo_ieee_signbit (double x) { return std::signbit (x); } -extern OCTAVE_API int __lo_ieee_float_isnan (float x); -extern OCTAVE_API int __lo_ieee_float_finite (float x); -extern OCTAVE_API int __lo_ieee_float_isinf (float x); +inline int __lo_ieee_float_isnan (float x) { return std::isnan (x); } +inline int __lo_ieee_float_finite (float x) { return std::isfinite (x); } +inline int __lo_ieee_float_isinf (float x) { return std::isinf (x); } extern OCTAVE_API int __lo_ieee_float_is_NA (float); @@ -94,7 +96,7 @@ extern OCTAVE_API float lo_ieee_float_na_value (void); extern OCTAVE_API float lo_ieee_float_nan_value (void); -extern OCTAVE_API int __lo_ieee_float_signbit (float); +inline int __lo_ieee_float_signbit (float x) { return std::signbit (x); } #if defined (__cplusplus) }