Grokking Modern System Design Interview for Engineers & Managers
Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.
Raising an element to a particular exponent power is a common practice in arithmetic. When conducting an arithmetical computation, we may need to know when to get the value of a number to a particular exponent. We can easily achieve this considering two values in Euphoria, using the power function.
This function is used to carry out an exponentiation operation. The power()
function raises a value, the base, to the power of another value, the exponent, and returns the output of such an operation.
power(baseValue, exponentValue)
baseValue
: This represents the value of the base which will be exponentiated.exponentValue
: This is the value of the exponent, which is the power that the base will be raised to.This function will return an exponentiated object value.
The following actions can cause this function to throw an exception error.
When a base value that is negative is raised to a value that is not an integer, it causes an error because the result is undefined.
Raising 0 to a negative power causes an error because it is similar to saying that zero is divided by something, which is mathematically erroneous.
Doing something like Power(0,0)
is an illegal operation because zero values do not really represent unique quantities.
Now that our understanding of this function is clear, let’s see some code examples.
--so let just go straight and print to screen some power outputputs(1,"This is the output of 2 to power of 5 : ")print(1,power(2,5))puts(1,"\n Result of 2 to power of 10, and 5 power 2 : ")print(1,power({2,5},{10,2}))puts(1,"\n This is the output of 4 to power of -3 : ")print(1,power(4 ,-3))
Several instances where different values are raised to the power of different exponents are showcased in the code above.
puts()
function prints some new lines and comments to the screen.print()
function, which prints the output to the screen after the power()
operation is carried out on some variables.RELATED TAGS
CONTRIBUTOR
Grokking Modern System Design Interview for Engineers & Managers
Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.