Simple Data Types in JD Application Architecture Design
3.1 Simple Data Types include six types: Integer, Character, Boolean, Enumeration, Subrange, and Real types. Except for Real types, each of the other five types has a limited range of values, where values are sequentially ordered with each value having a unique ordinal number n
. The values at positions n-1
and n+1
are adjacent. Such data types are known as Ordinal Types.
3.1.1 Integer Type: Integer types represent a subset of the mathematical set of all integers (positive, negative, and zero). For example, the byte type represents values from 0 to 255 (256 values in total), while shortint covers -128 to 127 (also 256 values). In Delphi2010, integer types include Integer, Cardinal, Shortint, Smallint, Longint, Int64, Byte, Word, Longword, and UInt64. The most commonly used are Integer (equivalent to longint) and Cardinal (equivalent to longword), both optimized for performance across various environments. The remaining six types are more specialized. The following table shows the range and storage format for each integer type:
| Type | Range | Format |
|-----------|-------------------------------|-----------------|
| Integer | -2,147,483,648..2,147,483,647 | signed 32-bit |
| Cardinal | 0..4,294,967,295 | unsigned 32-bit |
| Shortint | -128..127 | signed 8-bit |
| Smallint | -32,768..32,767 | signed 16-bit |
| Longint | -2,147,483,648..2,147,483,647 | signed 32-bit |
| Int64 | -2^63..2^63-1 | signed 64-bit |
| Byte | 0..255 | unsigned 8-bit |
| Word | 0..65,535 | unsigned 16-bit |
| Longword | 0..4,294,967,295 | unsigned 32-bit |
| UInt64 | 0..2^64-1 | unsigned 64-bit |
Note: Here, signed indicates the type can represent both positive and negative values, whereas unsigned restricts values to zero and positive numbers only.
3.1.2 Real Types: Real types, similar to integers, represent a subset of all real numbers. Their range and precision vary as shown below:
| Type | Range | Precision | Bytes |
|-----------|-------------------------------|-----------------|-------|
| Real48 | 2.9 x 10^-39 .. 1.7 x 10^38 | 11-12 digits | 6 |
| Single | 1.5 x 10^-45 .. 3.4 x 10^38 | 7-8 digits | 4 |
评论区