Challenge is writing a program that takes a positive numbers
a and a nonzero number
b and outputs
a^b (a raised to the power b). You can only use
+ - * / abs() as mathematical functions/operators. These can only be applied to scalar values, but not to whole lists or arrays.
1.234 ^ 5.678 = 3.29980 4.5 ^ 4.5 = 869.874 4.5 ^-4.5 = 0.00114959
You can write a function or a similar construct for using in console. If you cannot use console input you can assume that both numbers are saved in variables and ouptut via standard output or writing to a file. The output has to be correct to at least 4 significat digits. You can assume that both
b are nonzero. A runtime of significantly more than 1 minute is not acceptable. The least number of bytes will win. Please explain your program and your algorithm.
EDIT: Only positive bases have to be considered. You can assume
a>0. Be aware that both numbers do not have to be integers!!!