-- Chapter 6 - Program 6 with Text_IO; use Text_IO; procedure Fixed is COARSE_PI : constant := 3.15; type MY_FIXED is delta 0.1 range -40.0..120.0; type ANGLE is delta 0.05 range -COARSE_PI..COARSE_PI; Theta, Omega, Phi : ANGLE := 0.50; Funny_Value : MY_FIXED; package Int_IO is new Text_IO.Integer_IO(INTEGER); use Int_IO; package Fix_IO is new Text_IO.Fixed_IO(MY_FIXED); use Fix_IO; package Fix2_IO is new Text_IO.Fixed_IO(ANGLE); use Fix2_IO; package Flt_IO is new Text_IO.Float_IO(FLOAT); use Flt_IO; begin Put("Theta starts off with the value"); Put(Theta,5,2,0); New_Line(2); Theta := Omega + Phi; Theta := Omega - Phi; Theta := 5 * Omega - 2 * Phi; Theta := ANGLE(Omega * Phi); Theta := ANGLE(3 * Omega / Phi); Theta := abs(Omega - 3 * Phi); Funny_Value := 5.1; for Index in 1..10 loop Put("Funny_Value is now"); Put(Funny_Value,5,1,0); Put(Funny_Value,5,5,0); Funny_Value := MY_FIXED(Funny_Value * MY_FIXED(1.1)); New_Line; end loop; New_Line; Put("MY_FIXED'DELTA = "); Put(MY_FIXED(MY_FIXED'DELTA)); New_Line; Put("MY_FIXED'SMALL = "); Put(FLOAT(MY_FIXED'SMALL)); New_Line; Put("MY_FIXED'LARGE = "); Put(FLOAT(MY_FIXED'LARGE)); New_Line; Put("MY_FIXED'FIRST = "); Put(MY_FIXED'FIRST); New_Line; Put("MY_FIXED'LAST = "); Put(MY_FIXED'LAST); New_Line; end Fixed; -- Result of execution -- Theta starts off with the value 0.50 -- -- Funny_Value is now 5.1 5.06250 -- Funny_Value is now 5.4 5.37500 -- Funny_Value is now 5.7 5.68750 -- Funny_Value is now 6.0 6.00000 -- Funny_Value is now 6.4 6.37500 -- Funny_Value is now 6.8 6.75000 -- Funny_Value is now 7.1 7.12550 -- Funny_Value is now 7.6 7.56250 -- Funny_Value is now 8.0 8.00000 -- Funny_Value is now 8.5 8.50000 -- -- MY_FIXED'DELTA = 0.1 -- MY_FIXED'SMALL = 6.25000000000000E-02 -- MY_FIXED'LARGE = 1.27937500000000E+02 -- MY_FIXED'FIRST = -40.0 -- MY_FIXED'LAST = 120.0