Note the boundary condition or special circumstances:
1. The negative power of 0 cannot exist.
2. Generally, to the power of a negative number, you must calculate the power of a positive number and then divide it by 1.
3. Generally, the power of a number cannot be recycled. because of its low efficiency, it is best to use the square.
# Include <stdio. h> # include <stdlib. h> double normal_power (double data, int e) {double result; if (e = 0) return 1; if (e = 1) return data; result = normal_power (data, e> 1); result * = result; if (e & 0x1 = 1) result * = data; return result ;} double power (double data, int e) {double result; if (data-0.0>-0.0000001 & data-0.0 <0.0000001 & e <0) {// the negative power of 0 is returned-1;} if (e <0) {e =-e; result = normal_power (data, e ); result = 1.0/result;} else result = normal_power (data, e); return result;} void main () {printf ("% lf \ n ", power (2, 3); getch ();}