AP_Math: correct norm to need two arguments

Correctly use sqrtf instead of the double version
Stop casting to float since sq already returns one
This commit is contained in:
Francisco Ferreira 2017-06-21 01:32:55 +01:00 committed by Randy Mackay
parent f3d995a716
commit 7b98f41947

View File

@ -185,10 +185,10 @@ float sq(const T first, const Params... parameters)
* Variadic template for calculating the norm (pythagoras) of a vector of any
* dimension.
*/
template<class T, class... Params>
float norm(const T first, const Params... parameters)
template<class T, class U, class... Params>
float norm(const T first, const U second, const Params... parameters)
{
return sqrt(static_cast<float>(sq(first, parameters...)));
return sqrtf(sq(first, second, parameters...));
}
template<typename A, typename B>