Write C++ function to emulate standard pow()
Budget: $30 – $250 USD
Write pow() C++ function for "double" type without using any libraries:
> double pow_double( double base, double exp );
Requirements:
1) C++ function must not have any dependencies on internal or external libraries.
2) Function output must match internal C++ pow() function output (from standard math.h library)
3) Following 5 tests must all be successful (return expected values as defined below):
2.718280 to the power of -4.367328 is 0.012685
2.718280 to the power of 34.123578 is 660194045904200.875000
2.718280 to the power of -1.516792 is 0.219415
2.718280 to the power of -10.143565 is 0.000039
10.000000 to the power of 2.000000 is 100.000000
#include <stdio.h>
int main(void)
{
double x, y, z;
x = 2.718280;
y = -4.367328;
z = pow_double(x, y);
printf("%lf to the power of %lf is %lf\n", x, y, z);
}
> double pow_double( double base, double exp );
Requirements:
1) C++ function must not have any dependencies on internal or external libraries.
2) Function output must match internal C++ pow() function output (from standard math.h library)
3) Following 5 tests must all be successful (return expected values as defined below):
2.718280 to the power of -4.367328 is 0.012685
2.718280 to the power of 34.123578 is 660194045904200.875000
2.718280 to the power of -1.516792 is 0.219415
2.718280 to the power of -10.143565 is 0.000039
10.000000 to the power of 2.000000 is 100.000000
#include <stdio.h>
int main(void)
{
double x, y, z;
x = 2.718280;
y = -4.367328;
z = pow_double(x, y);
printf("%lf to the power of %lf is %lf\n", x, y, z);
}