Pre-defined Math Functions
Prepared by : Omar A. Fernandez, MSIT
Pre-defined Math Functions
• provides a math library that contains a set of pre-defined
mathematical functions.
• functions are included in the <cmath> header file
• allow you to perform various mathematical operations, such as
calculating square roots, raising numbers to power, and evaluating
trigonometric functions.
Math Library Functions
• sqrt
The sqrt function is used to calculate the square root of a number. It takes a
single argument and returns the square root as a double value.
Math Library Functions
Here's an example:
Math Library Functions
Here’s the output:
Math Library Functions
• Pow
The pow function is used to raise a number to a power.
It takes two arguments: the base number and the exponent. It returns the
result as a double value.
Math Library Functions
Here's an example:
Math Library Functions
Here’s the output: The output will be: "2.00 raised to the power of 3.00 is 8.00".
Math Library Functions
• Sin and cos
The sin and cos functions are used to calculate the sine and cosine of an angle,
respectively.
These functions take the angle in radians as an argument and return the
corresponding sine or cosine value as a double value.
Math Library Functions
Here's an example:
Math Library Functions
Here’s the output: The output will be: "Sine of 0.50 is 0.48" "Cosine of 0.50 is
0.88".
End – thank you
everyone

Finals Lesson 2 Pre defined Math Functions.pptx