Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer std:: functions when available rather than non std functions #1220

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions modules/core/include/visp3/core/vpMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,12 @@ long double vpMath::comb(unsigned int n, unsigned int p)
*/
int vpMath::round(double x)
{
#if defined(VISP_HAVE_FUNC_ROUND)
#if defined(VISP_HAVE_FUNC_STD_ROUND)
return (int)std::round(x);
#elif defined(VISP_HAVE_FUNC_ROUND)
//:: to design the global namespace and avoid to call recursively
// vpMath::round
return (int)::round(x);
#elif defined(VISP_HAVE_FUNC_STD_ROUND)
return (int)std::round(x);
#else
return (x > 0.0) ? ((int)floor(x + 0.5)) : ((int)ceil(x - 0.5));
#endif
Expand Down
36 changes: 18 additions & 18 deletions modules/core/src/math/misc/vpMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ const double vpMath::ang_min_mc = 2.5e-4;
*/
bool vpMath::isNaN(double value)
{
#if defined(VISP_HAVE_FUNC_ISNAN)
return isnan(value);
#elif defined(VISP_HAVE_FUNC_STD_ISNAN)
#if defined(VISP_HAVE_FUNC_STD_ISNAN)
return std::isnan(value);
#elif defined(VISP_HAVE_FUNC_ISNAN)
return isnan(value);
#elif defined(VISP_HAVE_FUNC__ISNAN)
return (_isnan(value) != 0);
#else
Expand All @@ -113,10 +113,10 @@ bool vpMath::isNaN(double value)
*/
bool vpMath::isNaN(float value)
{
#if defined(VISP_HAVE_FUNC_ISNAN)
return isnan(value);
#elif defined(VISP_HAVE_FUNC_STD_ISNAN)
#if defined(VISP_HAVE_FUNC_STD_ISNAN)
return std::isnan(value);
#elif defined(VISP_HAVE_FUNC_ISNAN)
return isnan(value);
#elif defined(VISP_HAVE_FUNC__ISNAN)
return (_isnan(value) != 0);
#else
Expand All @@ -136,10 +136,10 @@ bool vpMath::isNaN(float value)
*/
bool vpMath::isInf(double value)
{
#if defined(VISP_HAVE_FUNC_ISINF)
return isinf(value);
#elif defined(VISP_HAVE_FUNC_STD_ISINF)
#if defined(VISP_HAVE_FUNC_STD_ISINF)
return std::isinf(value);
#elif defined(VISP_HAVE_FUNC_ISINF)
return isinf(value);
#else
// Taken from OpenCV source code CvIsInf()
Vp64suf ieee754;
Expand All @@ -157,10 +157,10 @@ bool vpMath::isInf(double value)
*/
bool vpMath::isInf(float value)
{
#if defined(VISP_HAVE_FUNC_ISINF)
return isinf(value);
#elif defined(VISP_HAVE_FUNC_STD_ISINF)
#if defined(VISP_HAVE_FUNC_STD_ISINF)
return std::isinf(value);
#elif defined(VISP_HAVE_FUNC_ISINF)
return isinf(value);
#else
// Taken from OpenCV source code CvIsInf()
Vp32suf ieee754;
Expand All @@ -177,10 +177,10 @@ bool vpMath::isInf(float value)
*/
bool vpMath::isFinite(double value)
{
#if defined(VISP_HAVE_FUNC_ISFINITE)
return isfinite(value);
#elif defined(VISP_HAVE_FUNC_STD_ISFINITE)
#if defined(VISP_HAVE_FUNC_STD_ISFINITE)
return std::isfinite(value);
#elif defined(VISP_HAVE_FUNC_ISFINITE)
return isfinite(value);
#elif defined(VISP_HAVE_FUNC__FINITE)
return _finite(value);
#else
Expand All @@ -196,10 +196,10 @@ bool vpMath::isFinite(double value)
*/
bool vpMath::isFinite(float value)
{
#if defined(VISP_HAVE_FUNC_ISFINITE)
return isfinite(value);
#elif defined(VISP_HAVE_FUNC_STD_ISFINITE)
#if defined(VISP_HAVE_FUNC_STD_ISFINITE)
return std::isfinite(value);
#elif defined(VISP_HAVE_FUNC_ISFINITE)
return isfinite(value);
#elif defined(VISP_HAVE_FUNC__FINITE)
return _finitef(value);
#else
Expand Down
Loading