Rev | Line | |
---|
[9] | 1 | (*
|
---|
| 2 | (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
---|
| 3 | See the copyright notice in the ACK home directory, in the file "Copyright".
|
---|
| 4 | *)
|
---|
| 5 |
|
---|
| 6 | (*$R-*)
|
---|
| 7 | IMPLEMENTATION MODULE MathLib0;
|
---|
| 8 | (*
|
---|
| 9 | Module: Some mathematical functions
|
---|
| 10 | Author: Ceriel J.H. Jacobs
|
---|
| 11 | Version: $Header: /cvsup/minix/src/lib/ack/libm2/MathLib0.mod,v 1.1 2005/10/10 15:27:46 beng Exp $
|
---|
| 12 | *)
|
---|
| 13 |
|
---|
| 14 | IMPORT Mathlib;
|
---|
| 15 |
|
---|
| 16 | PROCEDURE cos(arg: REAL): REAL;
|
---|
| 17 | BEGIN
|
---|
| 18 | RETURN Mathlib.cos(arg);
|
---|
| 19 | END cos;
|
---|
| 20 |
|
---|
| 21 | PROCEDURE sin(arg: REAL): REAL;
|
---|
| 22 | BEGIN
|
---|
| 23 | RETURN Mathlib.sin(arg);
|
---|
| 24 | END sin;
|
---|
| 25 |
|
---|
| 26 | PROCEDURE arctan(arg: REAL): REAL;
|
---|
| 27 | BEGIN
|
---|
| 28 | RETURN Mathlib.arctan(arg);
|
---|
| 29 | END arctan;
|
---|
| 30 |
|
---|
| 31 | PROCEDURE sqrt(arg: REAL): REAL;
|
---|
| 32 | BEGIN
|
---|
| 33 | RETURN Mathlib.sqrt(arg);
|
---|
| 34 | END sqrt;
|
---|
| 35 |
|
---|
| 36 | PROCEDURE ln(arg: REAL): REAL;
|
---|
| 37 | BEGIN
|
---|
| 38 | RETURN Mathlib.ln(arg);
|
---|
| 39 | END ln;
|
---|
| 40 |
|
---|
| 41 | PROCEDURE exp(arg: REAL): REAL;
|
---|
| 42 | BEGIN
|
---|
| 43 | RETURN Mathlib.exp(arg);
|
---|
| 44 | END exp;
|
---|
| 45 |
|
---|
| 46 | PROCEDURE entier(x: REAL): INTEGER;
|
---|
| 47 | VAR i: INTEGER;
|
---|
| 48 | BEGIN
|
---|
| 49 | IF x < 0.0 THEN
|
---|
| 50 | i := TRUNC(-x);
|
---|
| 51 | IF FLOAT(i) = -x THEN
|
---|
| 52 | RETURN -i;
|
---|
| 53 | ELSE
|
---|
| 54 | RETURN -i -1;
|
---|
| 55 | END;
|
---|
| 56 | END;
|
---|
| 57 | RETURN TRUNC(x);
|
---|
| 58 | END entier;
|
---|
| 59 |
|
---|
| 60 | PROCEDURE real(x: INTEGER): REAL;
|
---|
| 61 | BEGIN
|
---|
| 62 | IF x < 0 THEN
|
---|
| 63 | RETURN - FLOAT(-x);
|
---|
| 64 | END;
|
---|
| 65 | RETURN FLOAT(x);
|
---|
| 66 | END real;
|
---|
| 67 |
|
---|
| 68 | BEGIN
|
---|
| 69 | END MathLib0.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.