DEFINITION MODULE DMMathLF;
(*******************************************************************
Module DMMathLF ('Dialog Machine' DM_V3.0)
Copyright (c) 1991-2006 by Andreas Fischlin and ETH Zurich.
Purpose Basic mathematical routines (as provided by module
DMMathLib), but with a fast implementation, which
uses possibly present floating point processors
(numerical behavior may be hardware dependent).
Remarks Macintosh implementation:
------------------------
Always requires the presence of a mathematical
coprocessor.
IBM PC implementation:
---------------------
Portable, not necessary most efficient implementation
provided.
Sun (Unix) implementation:
-------------------------
Portable, not necessary most efficient implementation
provided.
This module directly uses the mathematical
coprocessor which may render the code significantly
faster.
There are also companion modules named DMMathLib,
which work on any machine, regardless whether there is a
mathematical coprocessor actually present or not, thus
offering optimal portability, eventually at the price of
less efficiency.
This module belongs to the 'Dialog Machine'.
Programming
o Design
Andreas Fischlin 25/06/1991
o Implementation
Andreas Fischlin 25/06/1991
ETH Zurich
Systems Ecology
CHN E 35.1
Universitaetstrasse 16
8092 Zurich
SWITZERLAND
URLs:
<mailto:RAMSES@env.ethz.ch>
<http://www.sysecol.ethz.ch>
<http://www.sysecol.ethz.ch/SimSoftware/RAMSES>
Last revision of definition: 06/09/1995 AF
*******************************************************************)
PROCEDURE Sqrt (x: REAL): REAL;
PROCEDURE Exp (x: REAL): REAL;
PROCEDURE Ln (x: REAL): REAL;
PROCEDURE Sin (x: REAL): REAL;
PROCEDURE Cos (x: REAL): REAL;
PROCEDURE ArcTan(x: REAL): REAL;
PROCEDURE Real (x: INTEGER): REAL;
PROCEDURE Entier(x: REAL): INTEGER; (* Entier is similar to TRUNC,
but truncates also negative x
values to the smaller integral
part. Ex.: Entier(-3.3) returns
-4 where TRUNC(-3.3) is -3. *)
(*
Simple random number generators, which return variates in
ranges [0..upperBound] (RandomInt) resp. (0..1] (RandomReal).
Don't use these generators for serious stochastic simulations!
Their properties are not optimal. For better random number
generators see the modules RandGen, RandGen0, RandGen1,
RandNormal etc.
*)
PROCEDURE Randomize;
PROCEDURE RandomInt(upperBound: INTEGER): INTEGER;
PROCEDURE RandomReal(): REAL;
END DMMathLF.