Following:
#include <cmath> int main() { float base = 2.0f; float result = std::pow(base, 2); return 0; }
Raises warning a -Wconversionif it is enabled. Wandbox
-Wconversion
It seems that doubleoverload is being called std::powwhere I expect overload to be selected float(with an exponent intother than float). Can someone who knows its overload explain why?
double
std::pow
float
int
++ 11, pow - , double. double, , long double, long double.
pow
long double
[c.math]++ float long double overloaded ., , :, , long double, , , long double., , , double integer, , , double., , float.
++ float long double overloaded .
, , :
, , long double, , , long double.
, , , double integer, , , double.
, , float.
, :
cpp reference
7) , 1-3). - , . , Promoted double, .
" - , " , double float.
float pow( float base, float exp );
Source: https://habr.com/ru/post/1672948/More articles:Typescript: implicit type `this` for class methods - typescriptPHP - Google Maps API Search returns ZERO_RESULTS, but Navigator shows it - phpFiddler does not see API calls from C # HttpClient () - c #Warning when using file_get_contents for google api - phpEntry point for bokeh server - pythonDefine a "Storage Id" for the folder that uses the CLI to load and display credentials - jenkinsHow to install Microsoft.NETCore.Jit 1.0.2 package in Xamarin.iOS project, Version = v1.0? - c #How to access GCS console objects in projects using a service account? - google-app-engineWhat is the difference between list.files and dir? - rBootstrap: multiple selection fields inside one - javascriptAll Articles