diff --git a/Makefile b/Makefile index baffc66..e94181b 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ EXECUTABLE=$(BUILD)/test VERSION=$(shell sed -n 's/.*version \(.*\).*/\1/p' src/pugiconfig.hpp) RELEASE=$(filter-out scripts/archive.py docs/%.adoc,$(shell git ls-files contrib docs scripts src CMakeLists.txt readme.txt)) -CXXFLAGS=-g -Wall -Wextra -Werror -pedantic -Wundef -Wshadow -Wcast-align -Wcast-qual -Wold-style-cast +CXXFLAGS=-g -Wall -Wextra -Werror -pedantic -Wundef -Wshadow -Wcast-align -Wcast-qual -Wold-style-cast -Wdouble-promotion LDFLAGS= ifeq ($(config),release) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 4592ae7..39ea5b8 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -4656,7 +4656,7 @@ PUGI__NS_BEGIN PUGI__FN bool set_value_convert(String& dest, Header& header, uintptr_t header_mask, float value) { char buf[128]; - PUGI__SNPRINTF(buf, "%.9g", value); + PUGI__SNPRINTF(buf, "%.9g", double(value)); return set_value_ascii(dest, header, header_mask, buf); } @@ -8070,7 +8070,7 @@ PUGI__NS_BEGIN typedef uint32_t UI; // BCC5 workaround union { float f; UI i; } u; u.i = 0x7fc00000; - return u.f; + return double(u.f); #else // fallback const volatile double zero = 0.0; diff --git a/tests/test.cpp b/tests/test.cpp index 6347984..a97116e 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -117,7 +117,7 @@ bool test_xpath_number(const pugi::xpath_node& node, const pugi::char_t* query, double value = q.evaluate_number(node); double absolute_error = fabs(value - expected); - const double tolerance = 1e-15f; + const double tolerance = 1e-15; return absolute_error < tolerance || absolute_error < fabs(expected) * tolerance; } diff --git a/tests/test_dom_text.cpp b/tests/test_dom_text.cpp index 23b41e5..c71e54e 100644 --- a/tests/test_dom_text.cpp +++ b/tests/test_dom_text.cpp @@ -124,12 +124,12 @@ TEST_XML(dom_text_as_float, "010.12010.12-5.13e-43.14159265358979323846") diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index b135674..4a2403d 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -150,12 +150,12 @@ TEST_XML(dom_attr_as_float, "") diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp index 1a2c477..bc91c68 100644 --- a/tests/test_xpath.cpp +++ b/tests/test_xpath.cpp @@ -205,8 +205,8 @@ TEST(xpath_long_numbers_parse) xml_node c; // check parsing - CHECK_XPATH_NUMBER(c, str_flt_max, std::numeric_limits::max()); - CHECK_XPATH_NUMBER(c, str_flt_max_dec, std::numeric_limits::max()); + CHECK_XPATH_NUMBER(c, str_flt_max, double(std::numeric_limits::max())); + CHECK_XPATH_NUMBER(c, str_flt_max_dec, double(std::numeric_limits::max())); CHECK_XPATH_NUMBER(c, str_dbl_max, std::numeric_limits::max()); CHECK_XPATH_NUMBER(c, str_dbl_max_dec, std::numeric_limits::max()); }