Format: Numeric Values Representation
Storage formats for numerical data in XBUP protocol.
The following types are used to express the numeric values of usual types such as integers, real numbers and so on. These values can be expressed in several forms, mainly in the form of an attribute or a data block with a tightly defined range of values. Attribute blocks are also used in other blocks for the definition of attributes.
Assigned catalog indexes:
- WR17: XBUP/Math/Number
Basic Numbers
The aim of these blocks is to store the values of known types, such as natural or integer numbers. Most of these types can be represented as a block attribute. Below follows the approach for the basic representation. Alternative ways such as by calculation or other transformations will be presented elsewhere.
Natural Numbers
Type: XBUP/Math/Number Natural
Natural numbers, ie, within the meaning of non-negative integers with unlimited range, can be saved as a single block with the appropriate attribute, declared as type UBNatural.
Another possibility is to use numbers to represent a limited range of data block with a fixed length block encapsulation no other attributes, possibly with an attribute indicating the number of valid bytes or bits:
UBNatural ValidBytes
There are defined the following types with an adequate number of valid bits: Natural 8, 16, 24, 32, 48, 64.. Natural interval of values of type X then <0 .. (2^X)-1>. To store Natural values you have to use overhead, in this case it is at least 6 bytes. Example:
Data | Popis |
03 | Attribute Part's Size |
03 | Block's Size |
XX | UBNatural Group = XBUP/Math/Number |
XX | UBNatural Block = Natural 16 |
01 | Attribute Part's Size |
02 | Block's Size |
YY YY | Main Value |
Integer Numbers
Type: XBUP/Math/Number Integer
Basic integer is coded the same way as the value above, only if the attribute or binary data block used additional code that pushes the valid interval about half range into negative values, ie for integer X is the interval < -(2 ^ (X- 1)) .. (2 ^ (X-1)) -1 >.
Numeric Ratio
Type: XBUP/Math/Number Ratio
This type allows you to store the real numbers in the range <0..1> with binary precision and final binary decimal part (tail after point).
Compound Numbers
Compound numbers has typically larger cardinality than the cardinality of countable sets, so they are limited in scope. Value are realized by using more basic values, possibly using an appropriate approach for transformation to the fundamental value.
Real Numbers
Type: XBUP/Math/Number Real
Real numbers are restricted to the final binary decimal part (tail after point) and therefore it can be realized as a pair of integers, as follows:
UBReal Value
Other options are for example using one value for some subsets of real numbers, such as UBRatio etc.. Of course it is also possible to use the data block, for example, with a representation of value in IEEE 754 code.
Complex Numbers
Type: XBUP/Math/Number Complex, UBComplex
Complex numbers are realized as a pair of real numbers for rational and irrational part numbers.
Fractions
Fractions…
Page Source