Why we use ceil(x) function?
Answers
We use CEIL(X) function to RETURN THE SMALLEST INTEGER while comparing whether one is greater or equal to X.
The CEILING FUNCTION is the FUNCTION that takes as input a real number x and gives as output the SMALLEST INTEGER greater than or equal to x. This FUNCTION maps x to the least integer greater than or equal to x denoted by :-
ceil(x)=[x]
FOR EXAMPLE:- ceil(5.6)=[5.6]=7
That is when we use CEIL(X) we get the nearest greater integer value of X.
The ceil(x) function is not only used in any programming language but can also be used in mathematics to calculate.
We use ceil(x) function to get the nearest big rounded integer to the value in x.
Explanation :
- The function ceil() is a mathematical function, which should be imported from the library math as
from math import ceil
- The function ceil() takes a variable, which can be an integer or a floating value. You can also directly dump the value in the function rather than using a variable.
ceil(variable that contains a value / directly value)
- If you insert float value as a parameter into the ceil(), it results the nearest big rounded integer.
from math import ceil
ceil(7.2)
It gives 8 as output, as 8 is the nearest big rounded integer.
- If you insert an integer, it gives the same as output
from math import ceil
ceil(9)
It gives 9 as output, as 9 as 9 itself is a rounded integer.
Excited to gain more knowledge in python?
- There are few more mathematical functions which we use often. Know about them at :
https://brainly.in/question/18822209
- Are you a beginner? Wnat to know where python comes to handy Read out here.
https://brainly.in/question/11007952
Hope this answer helps you. Thank you!