Back to Shell

Numeric

docs/expressions/numeric.html

1.9.15866 B
Original Source

Numeric literals

There are two types of numbers. Integer and floating point.

Integer literals

An integer is a numeric literal(associated with numbers) without any fractional or exponential part. There are two types of integer literals:

  1. Decimal literal (base 10)
  2. Hexadecimal literal (base 16)

1. Decimal-literal(base 10):
A non-zero decimal digit followed by zero or more decimal digits(0, 1, 2, 3, 4, 5, 6, 7, 8, 9).

For example:

Decimal: 0, -9, 22 etc

2. Hexadecimal-literal(base 16):
0x followed by one or more hexadecimal digits(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f).

For example:

Hexadecimal: 0x7f, 0x2a, 0x521 etc
Floating-point iterals

Floating-point literals specify values that must have a fractional part. These values contain decimal points (.)

For example:

-2.00.0000234