[Command] round

Post Reply
User avatar
Raddeck
LP Manager
Reactions: 1
Posts: 508
Joined: Sat Oct 16, 2021 6:22 pm
Location: LpWorld
Contact:

Post by Raddeck »

{float variable}.round()


USE:
Use this function mathematically round a float variable.
Any value less than x.5 will be rounded down to "x" anything larger or equal to x.5 will be rounded up to x+1.


TYPE: Command, Non-Ref (ref-like syntax)
RETURNS: float variable
THEME: Math
COMPARE: floor()


EXAMPLE:

Code: Select all

    val = 1.4
    rv = val.round()
    fv = val.floor()
    "Val = <rv>, <fv>"  // Will output 'Val = 1, 1'
    
    val = 1.5
    rv = val.round()
    fv = val.floor()
    "Val = <rv>, <fv>"  // Will output 'Val = 2, 1'
Like my work? Buy me a coffee or support me on Patreon to keep it coming. :ugeek:
-Don't PM me for support-
Top
Post Reply