Background for Skyrim SE
Member of the Math script
intfunctionFloor(floatafValue)NativeGlobal

Description

Wiki Description

Calculates the largest integer less than or equal to the passed in value.

Documentation Comment

Calculates the floor of the passed in value - the largest integer less than or equal to the value


Caveats

CK Wiki - Notes

  • Casting a Float to an Int verifiably produces the same results for positive numbers and is measurably faster. Results with negative numbers differs since casting truncates the number going towards 0 while floor gets the closest lower integer, therefore going towards negative infinite.
int floored = Math.Floor(-0.7) ; result is -1
int casted = -0.7 as int ; result is 0

Parameters

floatafValue

CK Wiki Description

The value to get the floor of.


Examples

int x = Math.Floor(2.1) ; x == 2
int y = Math.Floor(5.9) ; y == 5
int z = Math.Floor(-0.7) ; z == -1

Auto-Generated Example

float myFloat__afValue

int returnedValue = Math.Floor(myFloat__afValue)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.