Help needed regarding some math functions

Hello everyone, I want to know what math.ceil and math.clamp does, I looked it up on the devforum but I didnt quite understand it.

math.ceil is the opposite of math.floor. It rounds upwards.

print(math.ceil(0.3)) --1

math.clamp basically sets the minimum and maximum of a number

The 1st argument is the number that you want to set, 2nd argument is the minimum, 3rd argument is the maximum.

math.clamp(number, minimum, maximum)
-- Example
print(math.clamp(7, 10, 20)) 
-- it will print 10 since 10 is the minimum and the number is less than min, so number is set to min

print(math.clamp(5, 1, 4)) 
-- it will print 4 since 4 is the maximum and the number is greater than max, so number is set to max

print(math.clamp(15, 10, 20)) 
-- it will print 15 since 15 is not less than minimum, and it is also not greater than maximum

It is basically just like doing this

local number = 8

-- math.clamp
number = math.clamp(number, 10, 20)
print(number) -- prints 10
local number = 8

-- alternate method
if number < 10 then
   number = 10
elseif number > 20 then
   number = 20
end

print(number) -- prints 10

math.ceil just rounds a number to the nearest number upwards

print(math.ceil(10.4)) -- 11
print(math.ceil(5.7)) -- 6
print(math.ceil(6.2)) -- 7

math.clamp takes 3 arguments, a number (lets call ‘x’), a minimum value, a maximum value.
if x is less than the minimum value, it returns the minimum value, if x is bigger than the maximum value, then it returns the maximum value, otherwise it returns the number itself.

print(math.clamp(9, 10, 20)) -- 10 (9 < 10)
print(math.clamp(22, 10, 20)) -- 20 (22 > 20)
print(math.clamp(15, 10, 20)) -- 15 (15 > 10 and 15 < 20)