9 #ifndef __AFW_NUMBER_H__
10 #define __AFW_NUMBER_H__
31 #define AFW_NUMBER_Q_INF "INF"
32 #define AFW_NUMBER_Q_INFINITY "Infinity"
33 #define AFW_NUMBER_Q_NEGATIVE_INF "-INF"
34 #define AFW_NUMBER_Q_NEGATIVE_INFINITY "-Infinity"
35 #define AFW_NUMBER_Q_NAN "NaN"
36 #define AFW_NUMBER_Q_NEGATIVE_NAN "-NaN"
37 #define AFW_NUMBER_Q_EXPONENT_ZERO "E0"
47 return (d <= DBL_MAX && d >= -DBL_MAX);
71 return (d < -DBL_MAX);
118 #define afw_number_parse_integer(cursor, len, i, p, xctx) \
119 afw_number_parse(cursor, len, i, NULL, NULL, p, xctx)
131 #define afw_number_parse_double(cursor, len, d, p, xctx) \
132 afw_number_parse(cursor, len, NULL, d, NULL, p, xctx)
177 if (!is_double || len != s->len) {
229 if (is_double || len != s->len) {
AFW_DEFINE(const afw_object_t *)
Adaptive Framework Common Header.
#define AFW_BEGIN_DECLARES
#define AFW_DECLARE(type)
Declare a public afw function.
double afw_double_t
Normal AFW number is double.
char afw_utf8_octet_t
8 bits of utf-8 codepoint.
apr_size_t afw_size_t
size_t.
apr_int64_t afw_integer_t
typedef for big signed int.
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
int afw_number_bytes_needed_size_t(afw_size_t i)
Determine bytes needed to hold printable size_t.
afw_double_t afw_number_utf8_to_double(const afw_utf8_t *s, const afw_pool_t *p, afw_xctx_t *xctx)
Convert a utf8 string to double in specified pool.
afw_integer_t afw_number_utf8_to_integer(const afw_utf8_t *s, const afw_pool_t *p, afw_xctx_t *xctx)
Convert a utf8 string to integer in specified pool.
afw_boolean_t afw_number_is_negative_infinity(double d)
Determine if double is negative infinity.
afw_boolean_t afw_number_is_NaN(double d)
Determine if double is not a number.
afw_boolean_t afw_number_is_finite(double d)
Determine if double is finite.
afw_size_t afw_number_parse(const afw_utf8_octet_t *cursor, afw_size_t len, afw_integer_t *i, afw_double_t *d, afw_boolean_t *is_double, const afw_pool_t *p, afw_xctx_t *xctx)
Parse an integer or double using specified pool for work area.
afw_size_t afw_number_integer_set_u8(afw_integer_t i, afw_utf8_octet_t *s, afw_size_t len, afw_xctx_t *xctx)
Convert an integer to u8 in supplied buffer.
const afw_utf8_t * afw_number_double_to_utf8(afw_double_t d, const afw_pool_t *p, afw_xctx_t *xctx)
Convert a double to utf8 in specified pool.
afw_number_bytes_needed_integer(afw_integer_t i)
Determine bytes needed to hold printable afw_integer_t.
afw_boolean_t afw_number_is_positive_infinity(double d)
Determine if double is positive infinity.
const afw_utf8_t * afw_number_integer_to_utf8(afw_integer_t i, const afw_pool_t *p, afw_xctx_t *xctx)
Convert an integer to utf8 in specified pool.
Interface afw_pool public struct.
NFC normalized UTF-8 string.
Interface afw_xctx public struct.