--with IO_EXCEPTIONS; use IO_EXCEPTIONS; with Text_io; use Text_io; with MATHS; use MATHS; with FIO; use FIO; procedure TESTMATHS is PI:constant:=3.14159_26535_89793_23846; TWO_PI:constant:=2.0*PI; PI_OVER_2:constant:=0.5*PI; DEG_TO_RAD:constant REAL:=PI/180.0; ACTION:character; INPUT:integer; X:REAL:=0.0; procedure HINT is begin Put_line("Input q to quit, i to input a number"); Put_line("p to print, r for root, l for log, n for ln"); Put_Line("c for cos, s for sin (with x in degrees"); end HINT; procedure Put(P:boolean) is begin Put(BOOLEAN'IMAGE(P)); end Put; begin HINT; loop begin -- to guard loop from exceptions if End_of_Line then New_line; Put("X irelncs...q? "); Skip_Line; end if; begin Get(X); exception when data_error=>null; end; Put(" X = ");Put(X);Put(", "); Get(ACTION); case ACTION is when 'q'|'x'=> exit; when 'r' => Put("SQRT(X)="); Put(SQRT(X)); when 'e' => Put("EXP(X)="); Put(EXP(X)); when 'l' => Put("LOG(X)="); Put(LOG(X)); when 'n' => Put("LN(X)="); Put(LN(X)); when 'c' => Put("COS(X)="); Put(COS(DEG_TO_RAD*X)); when 's' => Put("SIN(X)="); Put(SIN(DEG_TO_RAD*X)); when 'o'|'p'|'=' => Put(X); when others => HINT; end case; New_Line; exception when DATA_ERROR=>Put("X must be a number with a decimal point!"); when others=>raise; end; end loop; end TESTMATHS;