uint4 - ObjectVision/GeoDMS GitHub Wiki
Conversion functions uint4
- uint4 is a 4 bits unsigned integer Sub Byte Element.
- uint4() is a function converting data items or units of other value types to the uint4 value type.
This page describes the uint4() function.
- uint4(a)
- literal u4
uint4(a) results in a 4 bits unsigned integer item converted from tree item a. The function results for:
- integer data items: the integer value is interpreted as uint4 value, if the value exceeds the allowed value range for the uint4 value type, the resulting value will be 0;
- float32/64 data items: the value before the decimal point (so 1.9 will be rounded off to 1 and 2.0 to 2). If that value exceeds the allowed value range for the uint4 value type, the resulting value will be 0. Since GeoDMS 20.24.0 the range is checked on the value before the decimal point, so 15.9 gives 15 and 16.0 gives 0; up to 20.23.1 it was checked on the float itself, and a value between 15 and 16 gave 0;
- boolean data items: 1 for True values and 0 for False values;
- string data items, if the value starts with an allowed numeric value for the value type, this value is converted to a uint4 value type. Other characters after the numeric values are ignored. If the string does not start with an allowed numeric value for the value type, the resulting value will be 0;
- units, a 4 bits unsigned integer unit of the converted unit.
- data item or unit with Numeric, uint2, bool or string value type
- 5.15
- u4 suffix: since 7.105; since 20.24.0 a literal outside the range 0 to 15, such as
16u4, is refused instead of becoming 0 (see Literal)
1. parameter<uint4> uint4Numeric1 := uint4(1);
2. parameter<uint4> uint4Numeric1 := 1u4;
3. attribute<uint4> uint4A (ADomain) := uint4(A);
4. attribute<uint4> uint4B (ADomain) := uint4(B);
| A(float32) | B(string) | uint4A | uint4B |
|---|---|---|---|
| 0 | 'Hello' | 0 | 0 |
| 1 | 'Test' | 1 | 0 |
| 1000000 | null | 0 | 0 |
| -2.5 | 'Two words' | 0 | 0 |
| 99.9 | '88a' | 0 | 0 |
ADomain, nr of rows = 5