Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

Difference between revisions of "floor"

From Quake Wiki

m (Spirit moved page Floor to floor: lowercase)
 
Line 1: Line 1:
float '''floor'''(float ''val'')
+
''float'' '''floor'''(''float'' val)
  
Returns ''val'', rounded up to the integer below (like the equivalent function in C).
+
== Usage ==
 +
Rounds the passed number down to the next lowest whole number.
 +
 
 +
=== Parameters ===
 +
*''val''
 +
:The number to round down.
 +
 
 +
=== Return ===
 +
Returns the rounded down number.
 +
 
 +
== Example ==
 +
// When taking damage, remove the fractional part
 +
float damageToTake = floor(damage);
 +
e.health -= damageToTake;

Latest revision as of 12:40, 1 August 2023

float floor(float val)

Usage[edit]

Rounds the passed number down to the next lowest whole number.

Parameters[edit]

  • val
The number to round down.

Return[edit]

Returns the rounded down number.

Example[edit]

// When taking damage, remove the fractional part
float damageToTake = floor(damage);
e.health -= damageToTake;