home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog2 / moreders.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  1.5 KB  |  50 lines

  1.                                        -- Chapter 7 - Program 3
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure MoreDers is
  6.  
  7.                                   -- Some floating point types
  8.    type    NEW_FLOAT1 is digits 5;
  9.    type    NEW_FLOAT2 is digits 5 range 1.0..12.0;
  10.    type    DER_FLOAT  is new FLOAT;
  11.    type    LIM_FLOAT  is new FLOAT range 0.0..555.5;
  12.    subtype SUB_FLOAT  is     DER_FLOAT range -2.3..12.8;
  13.  
  14.                                   -- Some fixed point types
  15.    type    NEW_FIXED1 is delta 0.5  range 1.0..12.0;
  16.    type    NEW_FIXED2 is delta 0.05 range 1.0..12.0;
  17.    type    DER_FIXED  is new NEW_FIXED1;
  18.    type    LIM_FIXED  is new NEW_FIXED1 range 1.0..5.5;
  19.    subtype SUB_FIXED  is     DER_FIXED range 2.1..2.8;
  20.  
  21.                                   -- Some CHARACTER types
  22.    type    DER_CHAR   is new CHARACTER;
  23.    type    ALPHA_CHAR is new CHARACTER range 'A'..'Z';
  24.    subtype HEX_CHAR   is     ALPHA_CHAR range 'A'..'F';
  25.  
  26.                                   -- Some enumerated types
  27.    type    DAY         is (MON, TUE, WED, THU, FRI, SAT, SUN);
  28.    type    WEEKDAY     is new DAY range MON..FRI;
  29.    subtype BOWLING_DAY is WEEKDAY range WED..THU;
  30.  
  31.                                   -- Some floating point objects
  32.    Direction : FLOAT;
  33.    Speed     : DER_FLOAT := 100.0;
  34.    Length    : LIM_FLOAT := 72.41;
  35.    Size      : SUB_FLOAT := 4.3;
  36.  
  37. begin
  38.  
  39.    Direction := 1.2 + FLOAT(Length + LIM_FLOAT(Speed * Size));
  40.  
  41. end MoreDers;
  42.  
  43.  
  44.  
  45.  
  46. -- Result of execution
  47.  
  48. -- (There is no output from this program)
  49.  
  50.