u16()

Converts the given number to an unsigned 16-bit integer (`uint16`) by rounding to the nearest whole number and typecasting.

If the number exceeds the range of a `uint16` (0 to 65,535), it will wrap due to typecasting.

Syntax

u16(value)

Parameters

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

Return Value

Examples

u16(12345.6);   // returns 12346
u16(-1);        // returns 65535 (wrap)
u16(70000);     // returns 4464 (wrap)

See also

s8
u8
s16
u16
s32
u32