s8()

Converts the given number to a signed 8-bit integer (`int8`) by rounding to the nearest whole number and typecasting.

If the number exceeds the range of an `int8` (-128 to 127), it will wrap due to typecasting.

Syntax

s8(value)

Parameters

Parameter Type Description
value Number Numeric value to convert to int8.

Return Value

Examples

s8(10.7);   // returns 11
s8(-129);   // returns 127 (wrap)
s8(200);    // returns -56 (wrap)

See also

s8
u8
s16
u16
s32
u32