toBCD

Converts ushort value into BDC format

ushort
toBCD
(
ushort dec
)

Parameters

dec
Type: ushort

ushort in decimal format

Return Value

Type: ushort

BCD value

Examples

1 0.toBCD().shouldEqual(0);
2 10.toBCD().shouldEqual(0x10);
3 34.toBCD().shouldEqual(52);
4 127.toBCD().shouldEqual(0x127);
5 110.toBCD().shouldEqual(0x110);
6 9999.toBCD().shouldEqual(0x9999);
7 9999.toBCD().shouldEqual(39_321);

Meta