Navigation: Clarion.Net (Clarion#) > Clarion# Language Extensions > Simple Data Types >====== CLADECIMAL (signed packed decimal) ====== | ![]() ![]() ![]() |
label | CLADECIMAL(length [,places] [,initial value]) | [,DIM( )] [,NAME( )] [,EXTERNAL] [,DLL] |
[,STATIC] [,THREAD] [,AUTO] [,PRIVATE] | ||
[,PROTECTED] |
CLADECIMAL | A packed decimal floating point number. |
Format: ± magnitude
| . | …………………………… |
Bits: 127 124 0
Range: -9,999,999,999,999,999,999,999,999,999,999 to
+9,999,999,999,999,999,999,999,999,999,999
length | A required numeric constant containing the total number of decimal digits (integer and fractional portion combined) in the variable. The maximum length is 31. |
places | A numeric constant that fixes the number of decimal digits in the fractional portion (to the right of the decimal point) of the variable. It must be less than or equal to the length parameter. If omitted, the variable will be declared as an integer. |
initial value | A numeric constant. If omitted, the initial value is zero, unless the AUTO attribute is present. |
DIM | Dimension the variable as an array. |
NAME | Specify an alternate, “external” name for the field. |
EXTERNAL | Specify the variable is defined, and its memory is allocated, in an external library. Not valid within FILE, QUEUE, or GROUP declarations. |
DLL | Specify the variable is defined in a .DLL. This is required in addition to the EXTERNAL attribute. |
STATIC | Specify the variable's memory is permanently allocated. |
THREAD | Specify memory for the variable is allocated once for each execution thread. Also implicitly adds the STATIC attribute on Procedure Local data. |
AUTO | Specify the variable has no initial value. |
PRIVATE | Specify the variable is not visible outside the module containing the CLASS methods. Valid only in a CLASS. |
PROTECTED | Specify the variable is not visible outside base CLASS and derived CLASS methods. Valid only in a CLASS. |
CLADECIMAL declares a variable length packed decimal signed numeric variable. It is equivalent to the WIN32 DECIMAL data type. Each byte of a CLADECIMAL holds two decimal digits (4 bits per digit). The left-most byte holds the sign in its high-order nibble (0 = positive, anything else is negative) and one decimal digit. Therefore, CLADECIMAL variables always contain a fixed “odd” number of digits (CLADECIMAL(10) and CLADECIMAL(11) both use 6 bytes).
Example:
Count1 CLADECIMAL(5,0) !Declare three-byte signed packed decimal
Count3 CLADECIMAL(5,0),DIM(4) !Declare it an array of 4 decimals
Count4 CLADECIMAL(5,0,5) !Declare with initial value
Count5 CLADECIMAL(5,0),EXTERNAL !Declare as external
Count6 CLADECIMAL(5,0),EXTERNAL,DLL !Declare as external in a .DLL
Count7 CLADECIMAL(5,0),NAME('SixCount') !Declare with external name
Storage STRING(16)
ExampleFile FILE,DRIVER('TopSpeed') !Declare a file
Record RECORD
Count9 CLADECIMAL(5,0),NAME('Counter') !Declare with external name
END
END