Literals/Integer: Difference between revisions
Content added Content deleted
(→{{header|REXX}}: added/changed comments and whitespace, used a template for the output, used a different decimal value so that the REXX pgm displays both a viewable ASCII and EBCDIC character, shown more examples with blanks in them for readability.) |
(add example) |
||
Line 1,662: | Line 1,662: | ||
<lang Usala>t = 4534934521_</lang> |
<lang Usala>t = 4534934521_</lang> |
||
is used for numbers stored in binary converted decimal format, also with unlimited precision, which may perform better in applications involving very large decimal numbers. |
is used for numbers stored in binary converted decimal format, also with unlimited precision, which may perform better in applications involving very large decimal numbers. |
||
=={{header|Verbexx}}== |
|||
<lang verbexx>// Integer Literals: |
|||
// |
|||
// If present, base prefix must be: 0b 0B (binary) 0o 0O (octal) |
|||
// 0x 0X (hex) |
|||
// |
|||
// If present, length suffix must be: i I i64 I64 (INT64_T) |
|||
// u U u64 U64 (UINT64_T) |
|||
// i32 I32 (INT32_T) u32 U32 (UINT32_T) |
|||
// i16 I16 (INT16_T) u16 U16 (UINT16_T) |
|||
// i8 I8 (INT8_T) u8 U8 (UINT8_T) |
|||
// u1 U1 (BOOL_T) u0 U0 (UNIT_T) |
|||
@VAR s = " "; |
|||
// Binary Octal Decimal Hexadecimal |
|||
// ------------ ---------- ------------ -------------- |
|||
@SAY 0b1101 s 0o016 s 19999999 s 0xFfBBcC0088 ; // INT64_T |
|||
@SAY 0B0101 s 0O777 s -12345678 s 0X0a2B4c6D8eA ; // INT64_T |
|||
@SAY 0b1101I64 s 0o707I64 s 12345678i64 s 0xFfBBcC00i64 ; // INT64_T |
|||
@SAY 0b1101I s 0o57707i s -2345678I s 0xfafbbCc99i ; // INT64_T |
|||
@SAY 0b1001U64 s 0o555u64 s 33345678u64 s 0xFfaBcC00U64 ; // UINT64_T |
|||
@SAY 0b10010100U s 0o1234567u s 3338u s 0x99faBcC0EU ; // UINT64_T |
|||
@SAY 0B0101i32 s 0O753I32 s 987654i32 s 0XAAb4cCeeI32 ; // INT32_T |
|||
@SAY 0B0101u32 s 0O573u32 s 987654U32 s 0X0BAb4cCeeU32 ; // UINT32_T |
|||
@SAY 0B0101i16 s 0O753i16 s -017654I16 s 0X000cCffi16 ; // INT16_T |
|||
@SAY 0B0101u16 s 0O633U16 s 27654U16 s 0X000dDbBu16 ; // UINT16_T |
|||
@SAY 0B0101i8 s 0O153i8 s -000114I8 s 0X000ffi8 ; // INT8_T |
|||
@SAY 0B0101u8 s 0O132U8 s 00094U8 s 0X0000bu8 ; // UINT8_T |
|||
@SAY 0u1 0U1 ; // BOOL_T (FALSE) |
|||
@SAY 1u1 1U1 ; // BOOL_T (TRUE ) |
|||
@SAY 0u0 0U0 ; // UNIT_T |
|||
// note: _ (underscores) can appear in the main numeric part of the literal, |
|||
// after any base prefix, and before any length suffix. If there is |
|||
// no prefix, the numeric literal cannot begin with underscore: |
|||
@SAY 100_000 1_u1 0x_FFFF_u16 1__0__ 0x__7890_ABCD_EFAB_CDEF__u64;</lang> |
|||
=={{header|XPL0}}== |
=={{header|XPL0}}== |