7 kyu

The Power of Exponents

108 of 608Zedenem

Description:

This kata is based on: Exponent Method

Create a method called power that takes two integers and returns the value of the first argument raised to the power of the second.

Unlike the Exponent Method, you should also take in account negative exponents.

Your solution won't be tested against special cases leading to undefined values (0**-2 for example)

Note: The ** operator (JS: Math.pow) has been disabled.

Examples:

power(2, 3)   # 8
power(4, -2)  # 0.0625
power(2, 3)   // 8
power(4, -2)  // 0.0625
Mathematics
Algorithms

Stats:

CreatedMar 17, 2014
PublishedMar 17, 2014
Warriors Trained1046
Total Skips29
Total Code Submissions2245
Total Times Completed608
Ruby Completions108
JavaScript Completions515
Total Stars12
% of votes with a positive feedback rating85% of 165
Total "Very Satisfied" Votes125
Total "Somewhat Satisfied" Votes31
Total "Not Satisfied" Votes9
Total Rank Assessments41
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Zedenem Avatar
  • jhoffner Avatar
  • ZozoFouchtra Avatar
  • cliffstamp Avatar
Ad