(*
    Title: 	MathLib - Definitions
    LastEdit:	"Mon Sep 17 14:18:22 1984"
    Author: 	jd
		Cambridge University Computer Laboratory

    Mathematical functions
*)
DEFINITION MODULE MathLib;

EXPORT QUALIFIED 
    Pi, Radians, Degrees, Sin, Cos, Atan, Atan2, Exp
    (*, SinCosArgTooLarg, ExpOverflow *);

CONST Pi = 3.141592653589793238462;

PROCEDURE Radians (degrees: REAL): REAL; 
PROCEDURE Degrees (radians: REAL): REAL;

(* EXCEPTION SinCosArgTooLarge *)

PROCEDURE Sin (radians: REAL): REAL (* RAISES {SinCosArgTooLarge} *);
PROCEDURE Cos (radians: REAL): REAL (* RAISES {SinCosArgTooLarge} *);
PROCEDURE Atan (v: REAL): REAL;
(* arctangent of v in range [-Pi/2, Pi/2] *)
PROCEDURE Atan2 (v1, v2: REAL): REAL;
(* arctangent of v1 / v2 in range [-Pi, Pi]. To find the angle
   of a vector (x, y) use Atan2 (y, x).
*)
PROCEDURE Exp (x : REAL) : REAL (* RAISES {ExpOverflow} *);
(* exponentation  *)
        
END MathLib.
