Data Type System

Introduction

In our data type system, we have a set of 10 primitive types. The types available are:

  • BIT

  • U8 U16 U32 U64

  • S8 S16 S32 S64

  • F16

Each type carries specific properties that determine the range of values it can hold, and the amount of memory it takes up in the system.

Details of Types

  • BIT: A BIT represents a binary digit, which is the smallest unit of data in a computer system. It can hold one of two values, 0 or 1.

  • U8: U8 is an unsigned 8-bit integer. "Unsigned" means it can only represent non-negative whole numbers. Given it’s 8-bit, it can represent values from 0 to 255.

  • U16: U16 is an unsigned 16-bit integer. It can represent values from 0 to 65,535.

  • U32: U32 is an unsigned 32-bit integer. It can represent values from 0 to 4,294,967,295.

  • U64: U64 is an unsigned 64-bit integer. It can represent values from 0 to 18,446,744,073,709,551,615.

  • S8: S8 is a signed 8-bit integer. "Signed" means it can represent both positive and negative values. Given it’s 8-bit, it can represent values from -128 to 127.

  • S16: S16 is a signed 16-bit integer. It can represent values from -32,768 to 32,767.

  • S32: S32 is a signed 32-bit integer. It can represent values from -2,147,483,648 to 2,147,483,647.

  • S64: S64 is a signed 64-bit integer. It can represent values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

  • F16: F16 is a 16-bit floating point number. Floating point numbers can represent real numbers, including fractions and numbers with a decimal point. The range and precision of these numbers are implementation-dependent, but they generally provide a compromise between precision and range, allowing you to represent numbers as large as \$6.55 * 10^4\$ and as small as \$6.10 * 10^-5\$.

Each of these data types serves a specific purpose and can be used to optimize memory usage and computational performance in your system.