uint2 - ObjectVision/GeoDMS GitHub Wiki
Conversion functions Uint2
- uint2 is a 2 bits unsigned integer Sub Byte Element.
- uint2() is a function converting data items or units of other value types to the uint2 value type.
This page describes the uint2() function.
- uint2(a)
- literal u2
uint2(a) results in a 2 bits unsigned integer item converted from item a. The function results for:
- integer data items: the integer value is interpreted as uint2 value, if the value exceeds the allowed value range for the uint2 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 the value exceeds the allowed value range for the uint2 value type, the resulting value will be 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 uint2 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 2 bits unsigned integer unit of the converted unit.
- data item or unit with Numeric, uint4, bool or string value type
- 5.15
- u2 suffix: since 7.105
1. parameter<uint2> uint2Numeric1 := uint2(1);
2. parameter<uint2> uint2Numeric1 := 1u2;
3. attribute<uint2> uint2A (ADomain) := uint2(A);
4. attribute<uint2> uint2B (ADomain) := uint2(B);
A(float32) | B(string) | uint2A | uint2B |
---|---|---|---|
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