Основная часть рефакторинга закончена

This commit is contained in:
2020-04-22 20:59:39 +03:00
parent d6143953f6
commit f550594b85
33 changed files with 144 additions and 41 deletions

View File

@ -1,3 +1,8 @@
#ifndef MYX_MATH_ALL_HPP_
#define MYX_MATH_ALL_HPP_
#pragma once
#include <myx/math/almost_equal_relative.hpp>
#include <myx/math/almost_equal_relative_and_abs.hpp>
#include <myx/math/almost_equal_ulps.hpp>
@ -6,3 +11,5 @@
#include <myx/math/functions.hpp>
#include <myx/math/radar.hpp>
#include <myx/math/units.hpp>
#endif

View File

@ -1,3 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_RELATIVE_INL_HPP_
#define MYX_MATH_ALMOST_EQUAL_RELATIVE_INL_HPP_
#pragma once
#ifndef MYXLIB_HEADER_ONLY
#include <myx/math/almost_equal_relative.hpp>
#endif
@ -8,7 +13,7 @@ namespace myx {
namespace math {
bool almost_equal_relative( const float a, const float b,
MYXLIB_INLINE bool almost_equal_relative( const float a, const float b,
const float maxRelDiff )
{
float diff = fabsf( a - b );
@ -24,7 +29,7 @@ bool almost_equal_relative( const float a, const float b,
}
bool almost_equal_relative( const double a, const double b,
MYXLIB_INLINE bool almost_equal_relative( const double a, const double b,
const double maxRelDiff )
{
double diff = fabs( a - b );
@ -42,3 +47,5 @@ bool almost_equal_relative( const double a, const double b,
} // namespace math
} // namespace myx
#endif

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/math/almost_equal_relative-inl.hpp>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_RELATIVE_HPP_
#define MYX_MATH_ALMOST_EQUAL_RELATIVE_HPP_
#pragma once
#include <myx/base/config.hpp>
#include <cfloat>

View File

@ -1,3 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_RELATIVE_AND_ABS_INL_HPP_
#define MYX_MATH_ALMOST_EQUAL_RELATIVE_AND_ABS_INL_HPP_
#pragma once
#ifndef MYXLIB_HEADER_ONLY
#include <myx/math/almost_equal_relative_and_abs.hpp>
#endif
@ -8,7 +13,7 @@ namespace myx {
namespace math {
bool almost_equal_relative_and_abs( const float a, const float b,
MYXLIB_INLINE bool almost_equal_relative_and_abs( const float a, const float b,
const float maxAbsDiff, const float maxRelDiff )
{
// Check if the numbers are really close -- needed
@ -31,7 +36,7 @@ bool almost_equal_relative_and_abs( const float a, const float b,
}
bool almost_equal_relative_and_abs( const double a, const double b,
MYXLIB_INLINE bool almost_equal_relative_and_abs( const double a, const double b,
const double maxAbsDiff, const double maxRelDiff )
{
// Check if the numbers are really close -- needed
@ -56,3 +61,5 @@ bool almost_equal_relative_and_abs( const double a, const double b,
} // namespace math
} // namespace myx
#endif

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/math/almost_equal_relative_and_abs-inl.hpp>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_RELATIVE_AND_ABS_HPP_
#define MYX_MATH_ALMOST_EQUAL_RELATIVE_AND_ABS_HPP_
#pragma once
#include <myx/base/config.hpp>
#include <cfloat>

View File

@ -1,3 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_ULPS_INL_HPP_
#define MYX_MATH_ALMOST_EQUAL_ULPS_INL_HPP_
#pragma once
#ifndef MYXLIB_HEADER_ONLY
#include <myx/math/almost_equal_ulps.hpp>
#endif
@ -10,7 +15,7 @@ namespace myx {
namespace math {
bool almost_equal_ulps( const float a, const float b,
MYXLIB_INLINE bool almost_equal_ulps( const float a, const float b,
const int maxUlpsDiff )
{
FloatCmp uA( a );
@ -46,7 +51,7 @@ bool almost_equal_ulps( const float a, const float b,
} // almost_equal_ulps
bool almost_equal_ulps( const double a, const double b,
MYXLIB_INLINE bool almost_equal_ulps( const double a, const double b,
const int maxUlpsDiff )
{
DoubleCmp uA( a );
@ -84,3 +89,5 @@ bool almost_equal_ulps( const double a, const double b,
} // namespace math
} // namespace myx
#endif

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/math/almost_equal_ulps-inl.hpp>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_ULPS_HPP_
#define MYX_MATH_ALMOST_EQUAL_ULPS_HPP_
#pragma once
#include <myx/base/config.hpp>
#include <myx/math/float_cmp_types.hpp>

View File

@ -1,3 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_ULPS_INL_HPP_
#define MYX_MATH_ALMOST_EQUAL_ULPS_INL_HPP_
#pragma once
#ifndef MYXLIB_HEADER_ONLY
#include <myx/math/almost_equal_ulps_and_abs.hpp>
#endif
@ -10,7 +15,7 @@ namespace myx {
namespace math {
bool almost_equal_ulps_and_abs( const float a, const float b,
MYXLIB_INLINE bool almost_equal_ulps_and_abs( const float a, const float b,
const float maxAbsDiff, const int maxUlpsDiff )
{
// Check if the numbers are really close -- needed
@ -43,7 +48,7 @@ bool almost_equal_ulps_and_abs( const float a, const float b,
} // almost_equal_ulps_and_abs
bool almost_equal_ulps_and_abs( const double a, const double b,
MYXLIB_INLINE bool almost_equal_ulps_and_abs( const double a, const double b,
const double maxAbsDiff, const int maxUlpsDiff )
{
// Check if the numbers are really close -- needed
@ -78,3 +83,5 @@ bool almost_equal_ulps_and_abs( const double a, const double b,
} // namespace math
} // namespace myx
#endif

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/math/almost_equal_ulps_and_abs-inl.hpp>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_ULPS_HPP_
#define MYX_MATH_ALMOST_EQUAL_ULPS_HPP_
#pragma once
#include <myx/base/config.hpp>
namespace myx {

View File

@ -1,3 +1,8 @@
#ifndef MYX_MATH_CONSTANTS_INL_HPP_
#define MYX_MATH_CONSTANTS_INL_HPP_
#pragma once
#ifndef MYXLIB_HEADER_ONLY
#include <myx/math/constants.hpp>
#endif
@ -9,3 +14,5 @@ namespace math {
} // namespace math
} // namespace myx
#endif

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/math/constants-inl.hpp>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_CONSTANTS_HPP_
#define MYX_MATH_CONSTANTS_HPP_
#pragma once
#include <myx/base/config.hpp>
#include <cmath>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_FLOAT_CMP_TYPES_HPP_
#define MYX_MATH_FLOAT_CMP_TYPES_HPP_
#pragma once
#include <cstdint>
/**

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_FUNCTIONS_HPP_
#define MYX_MATH_FUNCTIONS_HPP_
#pragma once
#include <boost/math/special_functions/pow.hpp>
#include <cmath>
#include <type_traits>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_RADAR_HPP_
#define MYX_MATH_RADAR_HPP_
#pragma once
#include <cmath>
#include <type_traits>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_UNITS_HPP_
#define MYX_MATH_UNITS_HPP_
#pragma once
#include <cmath>
#include <type_traits>
@ -88,5 +90,4 @@ T magnitude_to_decibel( T const& magnitude )
} // namespace myx
#endif // MYX_MATH_UNITS_HPP_