State the value and type of each expression.
1. Math.abs(-5)-Math.abs(-7)
2.Math.abs(-1e-1) + Math.abs(-2e-2)
3.Math.sqrt(0.0064)
4.Math.sqrt(Math.pow(2.7, 2)
5.Math.round(3.499)
Answers
Answer:
1. 5-7=-2
2.
3.0.08
4.
5.4.0
Answer:
1. Math.abs(-5)-Math.abs(-7) ⇒ -2
2.Math.abs(-1e-1) + Math.abs(-2e-2) ⇒ 0.08
3.Math.sqrt(0.0064) ⇒ 0.08
4.Math.sqrt(Math.pow(2.7, 2) ⇒ 7.290000000000001
5.Math.round(3.499) ⇒ 4.0
Explanation:
To understand these expressions, first, you must know the functions that are used in these:
abs() function:
abs stand for absolute value. It finds out the absolute value of the number and returns it. It can be used with negative and complex numbers.
Example: abs(-5) = 5
sqrt() function:
sqrt() function is used to find out the square root of the number. This is the same as finding the square root in our maths class.
For example math.sqrt(4) = 2
pow() function:
pow stands for power. It is used to calculate the power of the number.
for example: math.pow(2,3) = 2³ = 8
round() function
This is used to round off the number. It returns the round-off figure.
For example: math.round(4.98) = 5.0
#SPJ2