home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / elan / plane / circle.eln next >
Text File  |  1987-08-18  |  950b  |  38 lines

  1. program:
  2.   INT CONST x0 :: graphics x limit DIV 2;
  3.   INT CONST y0 :: graphics y limit DIV 2;
  4.   REAL CONST radius :: real (min (x0, y0) DIV 2);
  5.   ask for starting point;
  6.   enter graphics mode;
  7.   heading;
  8.   drive point along a circle;
  9.   footing;
  10.   sleep (5);
  11.   enter text mode.
  12.  
  13.   ask for starting point:
  14.     REAL VAR t;
  15.     REP
  16.       line;
  17.       put ("Real number between 0.0 and 1.0: ");
  18.       get (t)
  19.     UNTIL 0.0 < t AND t < 1.0
  20.     ENDREP.
  21.  
  22.   heading:
  23.     put ("This program shows the cumulative effect of rounding errors.");
  24.     line;
  25.     put ("It multiplies a point on the unit circle repeatedly by itself").
  26.  
  27.   drive point along a circle:
  28.     POINT VAR x :: point (t, sqrt (1.0 - t * t));
  29.     REP
  30.       picture point (x);
  31.       x := x * x
  32.     UNTIL abs (x) > 2.0 OR abs (x) < 0.5
  33.     ENDREP.
  34.  
  35.   footing:
  36.     move (1, graphics y limit - line height);
  37.     put ("...until the point drops off the circle!").
  38.