math.floor
Available inall subroutines.
Computes the largest integer value less than or equal to the given value.In other words, roundx towards negative infinity.
For example, 2.2, 2.5, and 2.7 all floor to 2.0.
Return Value
Ifx ismath.NAN, a NaN will be returned.
Ifx is integral, ±0,x itself is returned.
Ifx ismath.POS_INFINITY ormath.NEG_INFINITY, an infinityof the same sign is returned.
Otherwise, the rounded value ofx is returned.
Try it out
math.floor is used in the following code examples. Examples apply VCL to real-world use cases and can be deployed as they are, or adapted for your own service. See thefull list of code examples for more inspiration.
Click RUN on a sample below to provision a Fastly service, execute the code on Fastly, and see how the function behaves.
Geofence / block access to content by region
Group countries to cache content by custom regions or reject requests from some regions entirely.