HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
G-: 18
{ }
{ The second variant of the record is designed to serve as a record }
{ overlay to access each of the decimal digits of the DECIMAL value. The }
{ digits are stored in elements 1 to 12 of the array. }
{ 1 1 1 1 1 1 }
{ bits: 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 }
{ shortint |===============================================================| }
{ [1] |<-digits[-2] ->|<-digits[-1] ->|<- digits[0] ->|<- digits[1] ->| }
{ |===============================================================| }
{ [2] |<- digits[2] ->|<- digits[3] ->|<- digits[4] ->|<- digits[5] ->| }
{ |===============================================================| }
{ [3] |<- digits[6] ->|<- digits[7] ->|<- digits[8] ->|<- digits[9] ->| }
{ |===============================================================| }
{ [4] |<- digits[10]->|<- digits[11]->|<- digits[12]->| | }
{ |===============================================================| }
{ }
{ NOTE: By definition, if shortint_rep[1] = 0 then the value of the DECIMAL }
{ number stored at that location is zero. }
{----------------------------------------------------------------------------}
type
t_decimal_type = packed record
case integer of
0: ( decimal_rep : t_decimal_exponent_mantissa_sign_rep );
1: ( digits : t_dec_digit_pack );
2: ( shortint_rep : t_shortint_rep_decimal );
3: ( longint_rep : longint );
end;
$page$
{----------------------------------------------------------------------------}
{ SHORT DECIMAL data type }
{----------------------------------------------------------------------------}
const
c_sdec_positive_mantissa = 0;
c_sdec_negative_mantissa = 1;
type
t_shortint_rep_short_decimal = array [1..2] of shortint;
t_sdec_digit_pack = packed array [-1..6] of 0..9;
t_sdecimal_exponent_mantissa_sign_rep =
packed record
exponent : -64..63;
mantissa_sign : c_sdec_positive_mantissa..c_sdec_negative_mantissa;
fill_16_bits : shortint
end;
{----------------------------------------------------------------------------}
{ SHORT DECIMAL }
{ The first variant of the record is designed to serve as a record overlay }
{ to quickly access the exponent and mantissa sign fields of the SHORT }
{ DECIMAL representation of a number. }
{ 1 1 1 1 1 1 }
{ bits: 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 }
{ shortint |===============================================================| }
{ [1] |<------- exponent -------->| * | | }
{ |===============================================================| }
{ [2] |<------------------------ fill_16_bits ----------------------->| }
{ |===============================================================| }
{ }
{ where the * is the bit used to represent the mantissa sign. }
{ }
{ The second variant of the record is designed to serve as a record }
{ overlay to access each of the decimal digits of the SHORT DECIMAL. The }
{ digits are stored in elements 1 to 6 of the array. }
{ 1 1 1 1 1 1 }
{ bits: 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 }
{ shortint |===============================================================| }