more_warnings="$more_warnings -Weverything"
more_warnings="$more_warnings -Wno-conversion"
more_warnings="$more_warnings -Wno-disabled-macro-expansion"
- more_warnings="$more_warnings -Wno-double-promotion"
- more_warnings="$more_warnings -Wno-float-conversion"
more_warnings="$more_warnings -Wno-format-nonliteral"
more_warnings="$more_warnings -Wno-padded"
more_warnings="$more_warnings -Wno-shorten-64-to-32"
conf->hash_dir = true;
conf->ignore_headers_in_manifest = x_strdup("");
conf->keep_comments_cpp = false;
- conf->limit_multiple = 0.8f;
+ conf->limit_multiple = 0.8;
conf->log_file = x_strdup("");
conf->max_files = 0;
conf->max_size = (uint64_t)5 * 1000 * 1000 * 1000;
bool hash_dir;
char *ignore_headers_in_manifest;
bool keep_comments_cpp;
- float limit_multiple;
+ double limit_multiple;
char *log_file;
unsigned max_files;
uint64_t max_size;
}
bool
-confitem_parse_float(const char *str, void *result, char **errmsg)
+confitem_parse_double(const char *str, void *result, char **errmsg)
{
- float *value = (float *)result;
+ double *value = (double *)result;
errno = 0;
char *endptr;
- float x = strtof(str, &endptr);
+ double x = strtod(str, &endptr);
if (errno == 0 && *str != '\0' && *endptr == '\0') {
*value = x;
return true;
}
char *
-confitem_format_float(void *value)
+confitem_format_double(void *value)
{
- float *x = (float *)value;
+ double *x = (double *)value;
return format("%.1f", *x);
}
hash_dir, 13, ITEM(hash_dir, bool)
ignore_headers_in_manifest, 14, ITEM(ignore_headers_in_manifest, env_string)
keep_comments_cpp, 15, ITEM(keep_comments_cpp, bool)
-limit_multiple, 16, ITEM(limit_multiple, float)
+limit_multiple, 16, ITEM(limit_multiple, double)
log_file, 17, ITEM(log_file, env_string)
max_files, 18, ITEM(max_files, unsigned)
max_size, 19, ITEM(max_size, size)
bool confitem_parse_env_string(const char *str, void *result, char **errmsg);
char *confitem_format_env_string(void *value);
-bool confitem_parse_float(const char *str, void *result, char **errmsg);
-char *confitem_format_float(void *value);
+bool confitem_parse_double(const char *str, void *result, char **errmsg);
+char *confitem_format_double(void *value);
bool confitem_parse_size(const char *str, void *result, char **errmsg);
char *confitem_format_size(void *value);
{"",0,0,NULL,NULL,NULL}, {"",0,0,NULL,NULL,NULL},
{"",0,0,NULL,NULL,NULL}, {"",0,0,NULL,NULL,NULL},
#line 39 "src/confitems.gperf"
- {"limit_multiple", 16, ITEM(limit_multiple, float)},
+ {"limit_multiple", 16, ITEM(limit_multiple, double)},
{"",0,0,NULL,NULL,NULL},
#line 37 "src/confitems.gperf"
{"ignore_headers_in_manifest", 14, ITEM(ignore_headers_in_manifest, env_string)}
unsigned hit = direct + preprocessed;
unsigned miss = counters->data[STATS_TOCACHE];
unsigned total = hit + miss;
- double percent = total > 0 ? (100.0f * hit) / total : 0.0f;
+ double percent = total > 0 ? (100.0 * hit) / total : 0.0;
printf("cache hit rate %6.2f %%\n", percent);
}
}
}
bool
-cct_check_float_eq(const char *file, int line, const char *expression,
- double expected, double actual)
+cct_check_double_eq(const char *file, int line, const char *expression,
+ double expected, double actual)
{
if (fabs(expected - actual) < DBL_EPSILON) {
cct_check_passed(file, line, expression);
return true;
} else {
- char *exp_str = format("%.1f", (double)expected);
- char *act_str = format("%.1f", (double)actual);
+ char *exp_str = format("%.1f", expected);
+ char *act_str = format("%.1f", actual);
cct_check_failed(file, line, expression, exp_str, act_str);
free(exp_str);
free(act_str);
// ============================================================================
-#define CHECK_FLOAT_EQ(expected, actual) \
+#define CHECK_DOUBLE_EQ(expected, actual) \
do { \
- if (!cct_check_float_eq(__FILE__, __LINE__, #actual, (expected), \
- (actual))) { \
+ if (!cct_check_double_eq(__FILE__, __LINE__, #actual, (expected), \
+ (actual))) { \
cct_test_end(); \
cct_suite_end(); \
return _test_counter; \
void cct_check_passed(const char *file, int line, const char *assertion);
void cct_check_failed(const char *file, int line, const char *assertion,
const char *expected, const char *actual);
-bool cct_check_float_eq(const char *file, int line, const char *expression,
- double expected, double actual);
+bool cct_check_double_eq(const char *file, int line, const char *expression,
+ double expected, double actual);
bool cct_check_int_eq(const char *file, int line, const char *expression,
int64_t expected, int64_t actual);
bool cct_check_str_eq(const char *file, int line, const char *expression,
CHECK(conf->hash_dir);
CHECK_STR_EQ("", conf->ignore_headers_in_manifest);
CHECK(!conf->keep_comments_cpp);
- CHECK_FLOAT_EQ(0.8f, conf->limit_multiple);
+ CHECK_DOUBLE_EQ(0.8, conf->limit_multiple);
CHECK_STR_EQ("", conf->log_file);
CHECK_INT_EQ(0, conf->max_files);
CHECK_INT_EQ((uint64_t)5 * 1000 * 1000 * 1000, conf->max_size);
CHECK(!conf->hash_dir);
CHECK_STR_EQ("a:b/c", conf->ignore_headers_in_manifest);
CHECK(conf->keep_comments_cpp);
- CHECK_FLOAT_EQ(1.0, conf->limit_multiple);
+ CHECK_DOUBLE_EQ(1.0, conf->limit_multiple);
CHECK_STR_EQ_FREE1(format("%s%s", user, user), conf->log_file);
CHECK_INT_EQ(17, conf->max_files);
CHECK_INT_EQ(123 * 1000 * 1000, conf->max_size);