Numerics
- Updated2025-10-31
- 2 minute(s) read
Use integer data types and floating-point numbers in PAscript locally and globally.
Definition Options for Integer and Floating-Point Data Types
The following definition options are available for integer and floating-point data types.
| Data Type | Global | Local |
|---|---|---|
| int8 | — | ✔ |
| int16 | — | ✔ |
| int32 | ✔ | ✔ |
| uint8 | — | ✔ |
| uint16 | — | ✔ |
| uint32 | — | ✔ |
| real32 | — | ✔ |
| real64 | ✔ | ✔ |
Limits for Data Types
Numeric data types have minimum values and maximum values based on their byte size.
| Data Type | Minimum | Maximum |
|---|---|---|
| int8 | -128 | 127 |
| int16 | -32.768 | 32.767 |
| int32 | -2.147.483.648 | 2.147.483.647 |
| uint8 | 0 | 255 |
| uint16 | 0 | 65.536 |
| uint32 | 0 | 4.294.967.295 |
| real32 | -3.402823466385e+38 | 3.402823466385e+38 |
| real64 | -1.797693134862e+308 | 1.797693134862e+308 |
Query the minimum and maximum limits of a data type using :min or :max. The data type of the target variable must be within the limits of the requested data type.
- The following calls are valid because the attribute return values or calculations are
within the limits of the corresponding variable data types.
- int8 maxInt8 = int8:max
- int8 minInt8 = int8:min
- uint32 maxUInt32 = uint16:max
- int8 var1 = int32:max + int32:min
- int8 var2 = int8:min + 5
- The following calls are not valid because the attribute return values or calculations
are outside the limits of the corresponding variable data types.
- uint16 minInt32 = int32:min
- int8 maxUInt16 = uint16:max
- int8 var1 = int16:min / 2
- int8 var2 = int8:min - 255
The rules apply analogously to the attributes of floating-point numbers.
Example: Querying the Minimum and Maximum Data Type
program section initialization sys:logInfo(sys:ui, "int8:min=%d, int8:max=%d", int8:min, int8:max) sys:logInfo(sys:ui, "int16:min=%d, int16:max=%d", int16:min, int16:max) sys:logInfo(sys:ui, "int32:min=%d, int32.max=%d", int32:min, int32:max) sys:logInfo(sys:ui, "uint8:min=%d, uint8:max=%d", uint8:min, uint8:max) sys:logInfo(sys:ui, "uint16:min=%u, uint16:max=%u", uint16:min, uint16:max) sys:logInfo(sys:ui, "uint32:min=%u, uint32:max=%u", uint32:min, uint32:max) sys:logInfo(sys:ui, "real32:min=%.12e, real32:max=%.12e", real32:min, real32:max) sys:logInfo(sys:ui, "real64:min=%.12e, real64:max=%.12e", real64:min, real64:max) endsection endprogram