14#define is_nan(a) _isnan(a)
18#define is_nan(a) std::isnan(a)
21#if defined __cplusplus
26static const char Okay_message[] =
"all is okay";
27static const char mallocError_message[] =
"could not allocate memory";
28static const char insufficientMemory_message[] =
"user's memory is too small to handle data";
29static const char badIndex_message[] =
"bad index";
30static const char XNotAscending_message[] =
"x values are not ascending";
31static const char badIndexForX_message[] =
"index not correct for x value";
32static const char XOutsideDomain_message[] =
"x value not in domain";
33static const char invalidInterpolation_message[] =
"bad x,y values for interpolation";
34static const char badSelf_message[] =
"source object has bad status value";
35static const char divByZero_message[] =
"division by zero";
36static const char unsupportedInterpolation_message[] =
"unsupported interpolation";
37static const char unsupportedInterpolationConversion_message[] =
"unsupported interpolation conversion";
38static const char empty_message[] =
"empty instance";
39static const char tooFewPoints_message[] =
"too few points in instance";
40static const char notMutualDomian_message[] =
"domains are not mutual";
41static const char unknownStatus_message[] =
"unknown (i.e., invalid) status value";
42static const char badInput_message[] =
"bad input to function";
43static const char badNorm_message[] =
"bad norm";
44static const char badIntegrationInput_message[] =
"bad integration input";
45static const char otherInterpolation_message[] =
"other integration not supported";
46static const char failedToConverge_message[] =
"failed to converge";
47static const char oddNumberOfValues_message[] =
"odd number of inputted values";
49static int nfu_debugging = 0;
70 if( sign < 0 )
return( -INFINITY );
79 case nfu_Okay :
return( Okay_message );
101 return( unknownStatus_message );
108 nfu_debugging = mode;
115 void *p = malloc( size );
117 if( nfu_debugging ) printf(
"nfu_malloc %12p size = %8llu\n", p, (
long long unsigned) size );
125 void *p = calloc( size, n );
127 if( nfu_debugging ) printf(
"nfu_calloc %12p size = %8llu, n = %8llu\n", p, (
long long unsigned) size, (
long long unsigned) n );
135 void *p = realloc( old, size );
137 if( nfu_debugging ) printf(
"nfu_realloc %12p size = %8llu", p, (
long long unsigned) size );
146 if( nfu_debugging ) printf(
"nfu_free %12p\n", p );
158 va_start( args, fmt );
159 vfprintf( stderr, fmt, args );
160 fprintf( stderr,
"\n" );
170 va_start( args, fmt );
171 vfprintf( stderr, fmt, args );
172 fprintf( stderr,
"\n" );
175 exit( EXIT_FAILURE );
178#if defined __cplusplus
void nfu_printErrorMsg(char *fmt,...)
@ nfu_unsupportedInterpolation
@ nfu_invalidInterpolation
@ nfu_badIntegrationInput
@ nfu_unsupportedInterpolationConversion
void nfu_setMemoryDebugMode(int mode)
enum nfu_status_e nfu_status
void nfu_printMsg(char *fmt,...)
void * nfu_realloc(size_t size, void *old)
void * nfu_calloc(size_t size, size_t n)
double nfu_getInfinity(double sign)
void * nfu_malloc(size_t size)
const char * nfu_statusMessage(nfu_status status)