Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Whens a g00d time t0 use math.floor and what is it good f0r?

I'm trying to learn a lot more this month to create at least another game! And i was wondering what it could be used for. The only things i know about math.floor is that its used in timers to round the number or something. Help?

1 comment

0

Why are you trying to avoid the bad title filter? Too powerful?

1 answer

✓ Accepted answer

math.floor

math.floor is a function used to round a number down to the nearest integer:

math.floor(5.112) = 5

math.floor(5.88) = 5

math.floor(-12.8) = -13


math.ciel

math.ciel is the opposite of math.floor, because it rounds up to nearest integer:

math.ciel(5.112) = 6

math.ciel(5.88) = 6

math.ciel(-12.8) = -12


Usage:

Both of these functions can be used to show a simplified form of data (e.g, the percentage of someones health is often <num>.<long-num>like 12.11211312423, and these functions will round it either 12% or 13%).


Hope I helped!

~TDP

2 comments

0

It's 'ceil' as in 'ceiling.' i before e except after c

This discussion is preserved as it was. New answers, comments, and votes are closed.