chiark / gitweb /
Add nlopt_isfinite
authorJoshua Nathaniel Pritikin <jpritikin@pobox.com>
Fri, 20 Mar 2015 18:12:20 +0000 (14:12 -0400)
committerJoshua Nathaniel Pritikin <jpritikin@pobox.com>
Fri, 20 Mar 2015 18:31:23 +0000 (14:31 -0400)
api/general.c
util/nlopt-util.h

index d97fcb5da0d79ec0d20f5facd1dcbdd64bb9591c..dfe20102de0d8d9a2a1d8ddb46bd75948b5fee41 100644 (file)
@@ -34,6 +34,11 @@ int nlopt_isinf(double x) {
 #endif
          ;
 }
+
+int nlopt_isfinite(double x) {
+    return fabs(x) <= DBL_MAX;
+}
+
 /*************************************************************************/
 
 void NLOPT_STDCALL nlopt_version(int *major, int *minor, int *bugfix)
index f460c2d0e2d6badca9ee86597956946de0e01af7..d20a8b1674e9c13249ade741e97bf6c7dfc81c97 100644 (file)
@@ -46,6 +46,7 @@ extern "C"
 #endif /* __cplusplus */
 
 int nlopt_isinf(double x);
+int nlopt_isfinite(double x);
 
 /* re-entrant qsort */
 extern void nlopt_qsort_r(void *base_, size_t nmemb, size_t size, void *thunk,