dos_compilers/Logitech Modula-2 v1/MATHLIB0.DEF
2024-06-30 15:16:10 -07:00

41 lines
1.0 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

DEFINITION MODULE MathLib0;
(*
Real Math Functions
From the book 'Programming in Modula-2' by Prof. N. Wirth.
*)
EXPORT QUALIFIED sqrt, exp, ln, sin, cos, arctan, real, entier;
PROCEDURE sqrt(x: REAL): REAL;
(* x must be positive *)
PROCEDURE exp(x: REAL): REAL;
(* returns e^x where e = 2.71828.. *)
PROCEDURE ln(x: REAL): REAL;
(* returns natural logarithm with base e = 2.71828.. of x *)
(* x must be positive and not zero *)
PROCEDURE sin(x: REAL): REAL;
(* returns sin(x) where x is given in radians *)
PROCEDURE cos(x: REAL): REAL;
(* returns cos(x) where x is given in radians *)
PROCEDURE arctan(x: REAL): REAL;
(* returns arctan(x) in radians *)
PROCEDURE real(x: INTEGER): REAL;
(* type conversion from INTEGER to REAL *)
PROCEDURE entier(x: REAL): INTEGER;
(* returns the integral part of x. *)
(* If this cannot be represented in an INTEGER, *)
(* the result is undefined. *)
END MathLib0.