Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
math_utils.h
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2016 The Earlham Institute
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 
24 #ifndef MATH_UTILS_H
25 #define MATH_UTILS_H
26 
28 #include "typedefs.h"
29 
30 #ifdef __cplusplus
31  extern "C" {
32 #endif
33 
34 
46 GRASSROOTS_UTIL_API int CompareDoubles (const double d1, const double d2);
47 
48 
60 GRASSROOTS_UTIL_API int CompareFloats (const float f1, const float f2);
61 
62 
75 GRASSROOTS_UTIL_API bool GetValidRealNumber (const char **str_pp, double64 *data_p, const char * const alternative_decimal_points_s);
76 
77 
88 GRASSROOTS_UTIL_API bool GetValidInteger (const char **str_pp, int *answer_p);
89 
90 
101 GRASSROOTS_UTIL_API bool GetValidLong (const char **str_pp, long *answer_p);
102 
103 
116 GRASSROOTS_UTIL_API int SortDoubles (const void *v1_p, const void *v2_p);
117 
118 
129 GRASSROOTS_UTIL_API char *ConvertIntegerToString (const int32 value);
130 
131 
142 GRASSROOTS_UTIL_API char *ConvertUnsignedIntegerToString (const uint32 value);
143 
144 
145 
156 GRASSROOTS_UTIL_API char *ConvertLongToString (const int64 value);
157 
158 
169 GRASSROOTS_UTIL_API char *ConvertDoubleToString (const double64 value);
170 
171 
172 
183 GRASSROOTS_UTIL_API char *ConvertSizeTToString (const size_t value);
184 
185 
186 
187 #ifdef __cplusplus
188 }
189 #endif
190 
191 
192 #endif /* #ifndef MATH_UTILS_H */
ConvertIntegerToString
char * ConvertIntegerToString(const int32 value)
Get an integer as a string, e.g.
GetValidLong
bool GetValidLong(const char **str_pp, long *answer_p)
Since atof, atoi, etc.
grassroots_util_library.h
ConvertDoubleToString
char * ConvertDoubleToString(const double64 value)
Get an double as a string, e.g.
GetValidInteger
bool GetValidInteger(const char **str_pp, int *answer_p)
Since atof, atoi, etc.
ConvertUnsignedIntegerToString
char * ConvertUnsignedIntegerToString(const uint32 value)
Get an unsigned integer as a string, e.g.
SortDoubles
int SortDoubles(const void *v1_p, const void *v2_p)
Compare two doubles taking the epsilon of this computer into account.
CompareDoubles
int CompareDoubles(const double d1, const double d2)
Compare two doubles taking the epsilon of this computer into account.
ConvertSizeTToString
char * ConvertSizeTToString(const size_t value)
Get an size_t as a string, e.g.
typedefs.h
GetValidRealNumber
bool GetValidRealNumber(const char **str_pp, double64 *data_p, const char *const alternative_decimal_points_s)
Since atof, atoi, etc.
CompareFloats
int CompareFloats(const float f1, const float f2)
Compare two floats taking the epsilon of this computer into account.
ConvertLongToString
char * ConvertLongToString(const int64 value)
Get an int64 as a string, e.g.
GRASSROOTS_UTIL_API
#define GRASSROOTS_UTIL_API
Definition: grassroots_util_library.h:47