Something analagous to exp2f()
I'm building a program with VS2019 but the main devs like it to be buildable with a wide range of compilers so I periodically check the build with VS2008.
Recently, someone's added a call to exp2f() but according to MSDN it looks like it wasn't available prior to VS2015. Is there anything else that'll do the same job?
[Edit...] In my dubious math skills, pow() looks promising... is pow(2.0, 4); equivalent to exp2f(4); :confused:
Re: Something analagous to exp2f()
exp2f() was introduced with C++11
Re pow(). Yes and no. pow(2.0, 4) will effectively do the same job as exp2f(4), but returns a double and not a float (as 2.0 is of type double). To be pedantic on this you would use pow(2.0f, 4) which would return a type float. Whether this is of importance depends upon the code.
Also note, that prior to C++11, pow() only takes an int for the power. exp2f() takes a float type as a power eg exp2f(2.4f) which would give a different result to using pow(2, 2.4). Now pow() takes type float/double as the power. Also note that back in the day, MS often didn't adhere strictly to the standard...