dos_compilers/Logitech Modula-2 v34/M2LIB/DEF/MATHLIB0.DEF
2024-07-02 07:25:31 -07:00

73 lines
1.1 KiB
Plaintext
Raw 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.

(* Abbreviation: MathLib0 *)
(* Version 1.10, Nov 1984 *)
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;
(*
- returns square root x
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 largest integer number less or equal x
Examples: entier(1.5) = 1; entier(-1.5) = -2;
If x cannot be represented in an INTEGER, the result is
undefined.
*)
END MathLib0.