move numeric utils into the public headers

resolves #398
This commit is contained in:
JCrawfy 2019-11-18 19:23:33 +13:00
parent a6fd7cc2b8
commit 2eb88c23d6
10 changed files with 12 additions and 12 deletions

View File

@ -31,6 +31,7 @@
namespace xlnt {
namespace detail {
/// <summary>
/// Takes in any number and outputs a string form of that number which will
/// serialise and deserialise without loss of precision
@ -84,8 +85,7 @@ constexpr typename std::common_type<NumberL, NumberR>::type min(NumberL lval, Nu
/// </summary>
template <typename EpsilonType = float, // the type to extract epsilon from
typename LNumber, typename RNumber> // parameter types (deduced)
bool
float_equals(const LNumber &lhs, const RNumber &rhs,
bool float_equals(const LNumber &lhs, const RNumber &rhs,
int epsilon_scale = 20) // scale the "fuzzy" equality. Higher value gives a more tolerant comparison
{
// a type that lhs and rhs can agree on
@ -111,7 +111,7 @@ float_equals(const LNumber &lhs, const RNumber &rhs,
// additionally, a scale factor is applied.
common_t scaled_fuzz = epsilon_scale * epsilon * max(max(xlnt::detail::abs<common_t>(lhs),
xlnt::detail::abs<common_t>(rhs)), // |max| of parameters.
common_t{1}); // clamp
common_t{1}); // clamp
return ((lhs + scaled_fuzz) >= rhs) && ((rhs + scaled_fuzz) >= lhs);
}

View File

@ -25,7 +25,7 @@
#include "xlnt/xlnt_config.hpp"
#include "xlnt/utils/exceptions.hpp"
#include "../source/detail/numeric_utils.hpp"
#include "xlnt/utils/numeric.hpp"
#include <type_traits>
namespace xlnt {

View File

@ -25,7 +25,7 @@
#include <xlnt/xlnt_config.hpp>
#include <xlnt/utils/optional.hpp>
#include "../source/detail/numeric_utils.hpp"
#include <xlnt/utils/numeric.hpp>
namespace xlnt {

View File

@ -22,7 +22,7 @@
// @author: see AUTHORS file
#include <detail/header_footer/header_footer_code.hpp>
#include <detail/numeric_utils.hpp>
//#include <detail/numeric_utils.hpp>
namespace xlnt {
namespace detail {

View File

@ -33,7 +33,7 @@
#include <xlnt/utils/optional.hpp>
#include <detail/implementations/format_impl.hpp>
#include <detail/implementations/hyperlink_impl.hpp>
#include "../numeric_utils.hpp"
//#include "../numeric_utils.hpp"
namespace xlnt {
namespace detail {

View File

@ -33,10 +33,10 @@
#include <detail/serialization/vector_streambuf.hpp>
#include <detail/serialization/xlsx_producer.hpp>
#include <detail/serialization/zstream.hpp>
#include <detail/numeric_utils.hpp>
#include <xlnt/cell/cell.hpp>
#include <xlnt/cell/hyperlink.hpp>
#include <xlnt/packaging/manifest.hpp>
#include <xlnt/utils/numeric.hpp>
#include <xlnt/utils/path.hpp>
#include <xlnt/utils/scoped_enum_hash.hpp>
#include <xlnt/workbook/workbook.hpp>

View File

@ -22,7 +22,7 @@
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/worksheet/page_margins.hpp>
#include "detail/numeric_utils.hpp"
#include <xlnt/utils/numeric.hpp>
namespace xlnt {

View File

@ -22,7 +22,7 @@
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/worksheet/page_setup.hpp>
#include "detail/numeric_utils.hpp"
#include <xlnt/utils/numeric.hpp>
namespace xlnt {

View File

@ -46,7 +46,7 @@
#include <xlnt/worksheet/column_properties.hpp>
#include <detail/constants.hpp>
#include <detail/default_case.hpp>
#include <detail/numeric_utils.hpp>
#include <xlnt/utils/numeric.hpp>
#include <detail/unicode.hpp>
#include <detail/implementations/cell_impl.hpp>
#include <detail/implementations/workbook_impl.hpp>

View File

@ -21,7 +21,7 @@
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include "../../source/detail/numeric_utils.hpp"
#include <xlnt/utils/numeric.hpp>
#include <helpers/test_suite.hpp>
class numeric_test_suite : public test_suite