From 433bc81b30e981ad004aa5c2b8110a3e2b61c4f8 Mon Sep 17 00:00:00 2001 From: Viet Dinh Date: Tue, 3 Nov 2015 21:40:52 -0500 Subject: [PATCH] std::cbrt could not be found --- modules/core/src/mathfuncs.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/core/src/mathfuncs.cpp b/modules/core/src/mathfuncs.cpp index a3ab97793..eb0cac638 100644 --- a/modules/core/src/mathfuncs.cpp +++ b/modules/core/src/mathfuncs.cpp @@ -2552,7 +2552,8 @@ double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters ) cube_coefs.at(0) = 64; cv::solveCubic(cube_coefs, cube_roots); - num.re = std::cbrt(cube_roots.at(0)); + num.re = std::pow(std::abs(cube_roots.at(0)), 1/3); + if(cube_roots.at(0) < 0) num.re = -num.re; num.im = std::sqrt(std::pow(num.re, 2) / 3 - old_num_re / (3*num.re)); } }