64bit and 32bit Integer and Float Types

Numeric types

  • int - 64bit integer
  • short - 32bit integer
  • double - 64bit floating point
  • float - 32bit floating point

Constants

Since Argentum numeric constants define both value and type, there were added two suffixes (f and s):

  • 3.14f - a 32bit floating point (float)
  • 2f - also 32bit floating point
  • -3.14e-1f - also 32bit floating point in full exponential form.
  • 0s - a 32-bit integer (short)
  • 0xffffs - also a 32bit in hexadecimal

32-bit constants are limited to:

  • 31 significant bits - if decimal - (apply unary minus to change sign if needed)
  • 32 significant bits - if binary, octal, hexadecimal

Constants without suffixes define 64bit values.

Operations

  • unary bitwise inversion (~) when applied to short, produce short, when applied to int - produce int
  • unary minus is applicable to all numeric types; it produce the result of the same type
  • binary operations +-*/ are applicable to all numeric types; they require both operands to be of the same type and produce result of the same type
  • binary bitwise operators << >> & | ^ applicable to short and int; they require both operands to be of the same type and produce result of the same type
  • comparisons < > <= >= != == applicable to all numeric types and require operands of the same type; producing bool.

All integers operations are defined in 32 or 64 bit two's complement arithmetic.

Conversions

There are no automatic conversions between numeric types. All conversions should be performed explicitly:

  • int(expr) - converts expr to 64bit integer:
    • if expr it short (32bit) - it performs sign-extension
    • if expr is float or double, it converts floating-point value to 64bit int
  • short(expr) - converts expr to 32bit integer:
    • from int (64bit) - it truncates higher bits
    • from floating-point type - it rounds fractional part and truncates higher bits
  • float(expr) - converts int, short, double to float
  • double(expr) - converts int, short, float to double.

Blobs

  • set8At, set16At, set32At - take 32bit (short) values
  • get8At, get16At, get32At - return 32bit (short) results
  • putChAt - takes 32bit code-point

Strings

All character code-points are 32bit:

  • Cursor.getCh, peekCh - return 32bit code-point
  • built-in macro utf32_(expr, expr,...) expects 32bit code points
  • Character constants 'H' - produce 32bit character code (short)

Leave a Reply

Your email address will not be published. Required fields are marked *