math.exp2

FLOATmath.exp2FLOATx

Available inall subroutines.

Computes the value of 2 raised to the x power (e.g., 2ˣ).

This is equivalent to shifting the integer 1 to x bits to the left (e.g., 2^x == 1 << x), except that math.exp2 is only for FLOAT type values.

Example

vcl_deliver {
declare local var.foo FLOAT;
set var.foo = math.exp2(32); # result: 4294967296.0
}

User contributed notes

BETA

Do you see an error in this page? Do have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact support@fastly.com)