Class RTS_ENVIRONMENT
- Direct Known Subclasses:
RTS_BASICIO
System class ENVIRONMENT.
The purpose of the environmental class is to encapsulate all constants, procedures and classes which are accessible to all source modules. It contains procedures for mathematical functions, text generation, random drawing, etc.
Link to GitHub: Source File.
- Author:
- SIMULA Standards Group, Øystein Myhre Andersen
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static long
The start time from System.currentTimeMillis(package private) static char
The current decimal mark character.(package private) static char
The current lowten character.static RTS_PRCQNT
The registered EXCEPTION_HANDLER or null.static final int
A constant holding the maximum value an integer can have.static final double
A constant holding the maximum value a long real can have.static final float
A constant holding the maximum value a real can have.static final int
A constant holding the minimum value an integer can have.static final double
A constant holding the minimum value a long real can have.static final float
A constant holding the minimum value a real can have.(package private) static final String
The Simula release identification.Fields inherited from class simula.runtime.RTS_RTObject
_CORUT, _CTX, _CUR, _DL, _INPUT_LINELENGTH, _JTX, _OUTPUT_LINELENGTH, _SL, _STATE, _SYSIN, _SYSOUT, _USR, startTimeMs
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic char
_char
(int i) Standard Procedure char.static double
abs
(double e) Standard Procedure abs.static float
abs
(float e) Standard Procedure abs.static int
abs
(int e) Standard Procedure abs.static double
addepsilon
(double x) Standard Procedure addepsilon.static float
addepsilon
(float x) Standard Procedure addepsilon.static double
arccos
(double r) Standard Procedure arccos.static double
arcsin
(double r) Standard Procedure arcsin.static double
arctan
(double r) Standard Procedure arctan.static double
arctan2
(double y, double x) Standard Procedure arctan2.static RTS_TXT
argv
(int index) Extended Standard procedure argv.static RTS_TXT
blanks
(int n) Standard Procedure blanks.static char
Char
(int i) Standard Procedure char.static double
Standard Procedure clocktime.static RTS_TXT
Standard Procedure copy.static double
cos
(double r) Standard Procedure cos.static double
cosh
(double r) Standard Procedure cosh.static double
cotan
(double r) Standard Procedure cotan.static double
cputime()
Standard Procedure cputime.static RTS_TXT
datetime()
Standard Procedure datetime.static char
decimalmark
(char c) Standard Procedure decimalmark.static void
DEFEXCEPTION
(RTS_PRCQNT EXCEPTION_HANDLER) S-PORT Extension Procedure DEFEXCEPTION.static boolean
digit
(char c) Standard Procedure digit.static int
Random drawing: discrete distribution.static boolean
Random drawing: Procedure draw.static RTS_TXT
edfix
(double r, int n) Extended Standard procedure edit.static RTS_TXT
edfix
(float r, int n) Extended Standard procedure edit.static RTS_TXT
edit
(boolean n) Extended Standard procedure edit.static RTS_TXT
edit
(char n) Extended Standard procedure edit.static RTS_TXT
edit
(double n) Extended Standard procedure edit.static RTS_TXT
edit
(float n) Extended Standard procedure edit.static RTS_TXT
edit
(int n) Extended Standard procedure edit.static RTS_TXT
edit
(long n) Extended Standard procedure edit.static RTS_TXT
edtime
(double hours) Edit simulated time.static RTS_TXT
edtime
(float hours) Edit simulated time.static int
entier
(double d) Standard Procedure entier.static double
Random drawing: Erlang distribution.static void
Standard Procedure error.static void
exit
(int status) Extended Standard procedure exit.static double
exp
(double r) Standard Procedure exp.static int
S-PORT Extension Procedure hash.static int
histd
(RTS_REALTYPE_ARRAY A, RTS_NAME<Integer> U) Utility: Procedure histd.static void
histo
(RTS_REAL_ARRAY A, RTS_REAL_ARRAY B, float c, float d) Standard Procedure histo.private static boolean
illegalLowten
(char c) Check if the given character is illegal as lowten.static char
isochar
(int i) Standard Procedure isochar.static int
isorank
(char c) Standard Procedure isorank.static boolean
letter
(char c) Standard Procedure letter.static double
Random drawing: linear distribution.static double
ln
(double r) Standard Procedure ln.static char
Text Extension Procedure loadChar.static double
log10
(double r) Standard Procedure log10.static RTS_TXT
Standard Procedure lowcase.static int
lowerbound
(RTS_ARRAY a, int i) Standard Procedure lowerbound.static char
lowten
(char c) Standard Procedure lowten.static char
max
(char x, char y) Standard Procedure max.static double
max
(double x, double y) Standard Procedure max.static double
max
(double x, float y) Standard Procedure max.static double
max
(double x, int y) Standard Procedure max.static double
max
(float x, double y) Standard Procedure max.static float
max
(float x, float y) Standard Procedure max.static float
max
(float x, int y) Standard Procedure max.static double
max
(int x, double y) Standard Procedure max.static float
max
(int x, float y) Standard Procedure max.static int
max
(int x, int y) Standard Procedure max.static RTS_TXT
Standard Procedure max.static char
min
(char x, char y) Standard Procedure min.static double
min
(double x, double y) Standard Procedure min.static double
min
(double x, float y) Standard Procedure min.static double
min
(double x, int y) Standard Procedure min.static double
min
(float x, double y) Standard Procedure min.static float
min
(float x, float y) Standard Procedure min.static float
min
(float x, int y) Standard Procedure min.static double
min
(int x, double y) Standard Procedure min.static float
min
(int x, float y) Standard Procedure min.static int
min
(int x, int y) Standard Procedure min.static RTS_TXT
Standard Procedure min.static int
mod
(int i, int j) Standard Procedure mod.static double
Random drawing: negexp distribution.static double
Random drawing: normal distribution.static int
Random drawing: Poisson distribution.static void
Extended Standard procedure printStaticChain.static void
printThreadList
(boolean withStackTrace) Extended Standard procedure printThreadList.static int
Random drawing: randint distribution.static int
rank
(char c) Standard Procedure rank.static int
rem
(int i, int j) Standard Procedure rem.static int
sign
(double e) Standard Procedure sign.static RTS_TXT
simulaid()
Simula identification String.static double
sin
(double r) Standard Procedure sin.static double
sinh
(double r) Standard Procedure sinh.static double
sqrt
(double r) Standard Procedure sqrt.static void
Text Extension Procedure storeChar.static double
subepsilon
(double x) Standard Procedure subepsilon.static float
subepsilon
(float x) Standard Procedure subepsilon.static double
tan
(double r) Standard Procedure tan.static double
tanh
(double r) Standard Procedure tanh.static double
Random drawing: uniform distribution.static RTS_TXT
Standard Procedure uppercase.static int
upperbound
(RTS_ARRAY a, int i) Standard Procedure upperbound.static void
waitSomeTime
(int millies) Extended Standard procedure waitSomeTime.Methods inherited from class simula.runtime.RTS_RTObject
_GOTO, _JUMPTABLE, _SIM_LABEL, _STM, _TREAT_GOTO_CATCH_BLOCK, _VALUE, arrayValue, BBLK, booleanValue, call, call, charValue, CONC, detach, detach, detach, doubleValue, EBLK, edObjectAttributes, edObjectIdent, floatValue, intValue, isDetachUsed, isQPSystemBlock, objectTraceIdentifier, objectTraceIdentifier, objectValue, procValue, resume, resume, resume, swapCoroutines, sysin, sysout, toString, TRACE_GOTO
-
Field Details
-
simulaReleaseID
The Simula release identification.
NOTE: When updating release id, change version in setup.SimulaExtractor and simula.Global
- See Also:
-
_STARTTIME
static long _STARTTIMEThe start time from System.currentTimeMillis -
CURRENTLOWTEN
static char CURRENTLOWTENThe current lowten character. -
CURRENTDECIMALMARK
static char CURRENTDECIMALMARKThe current decimal mark character. -
maxlongreal
public static final double maxlongrealA constant holding the maximum value a long real can have.- See Also:
-
minlongreal
public static final double minlongrealA constant holding the minimum value a long real can have.- See Also:
-
maxreal
public static final float maxrealA constant holding the maximum value a real can have.- See Also:
-
minreal
public static final float minrealA constant holding the minimum value a real can have.- See Also:
-
maxint
public static final int maxintA constant holding the maximum value an integer can have.- See Also:
-
minint
public static final int minintA constant holding the minimum value an integer can have.- See Also:
-
EXCEPTION_HANDLER
The registered EXCEPTION_HANDLER or null.
-
-
Constructor Details
-
RTS_ENVIRONMENT
Normal Constructor- Parameters:
staticLink
- static link
-
-
Method Details
-
simulaid
Simula identification String.
The value of "simulaid" is an implementation defined string of the following general format:
!!! !!! !!! !!! !!! !!! !!! : Identification of the SIMULA system (name, version etc.) : Identification of the installation (e.g. organisation name) : Operating system identification (name, version, etc.) : Host system identification (manufacturer, name, number, etc.) : User identification : Job identification (session number) : Account identification : Identification of the executing task or program - Returns:
- Simula identification String.
-
mod
public static int mod(int i, int j) Standard Procedure mod.
integer procedure mod(i,j); integer i,j; begin integer res; res := i - (i//j)*j; mod := if res = 0 then 0 else if sign(res) ne sign(j) then res+j else res end mod;
The result is the mathematical modulo value of the parameters.
- Parameters:
i
- argument ij
- argument j- Returns:
- the resulting mod
-
rem
public static int rem(int i, int j) Standard Procedure rem.
integer procedure rem(i,j); integer i,j; rem := i - (i//j)*j;
The result is the remainder of an integer division.
- Parameters:
i
- argument ij
- argument j- Returns:
- the resulting rem
-
abs
public static int abs(int e) Standard Procedure abs.
procedure abs(e); e; abs := if e >= 0 then e else -e; The result is the absolute value of the parameter.
- Parameters:
e
- the argument- Returns:
- the resulting abs value
-
abs
public static float abs(float e) Standard Procedure abs. Seeabs(int)
- Parameters:
e
- the argument- Returns:
- the resulting abs value
-
abs
public static double abs(double e) Standard Procedure abs. Seeabs(int)
- Parameters:
e
- the argument- Returns:
- the resulting abs value
-
sign
public static int sign(double e) Standard Procedure sign.- Parameters:
e
- the argument e- Returns:
- resulting sign code
-
entier
public static int entier(double d) Standard Procedure entier.
integer procedure entier(r);
r; begin integer j; j := r; ! implied conversion of "r" to integer ; entier:= if j > r ! implied conversion of "j" to real ; then j-1 else j end entier; The result is the integer "floor" of a real type item, the value always being less than or equal to the parameter. Thus, entier(1.8) returns the value 1, while entier(-1.8) returns -2.
- Parameters:
d
- argument d- Returns:
- the resulting entier
-
addepsilon
public static float addepsilon(float x) Standard Procedure addepsilon.
procedure addepsilon(e); e; addepsilon := e + ... ; ! see below; The result type is that of the parameter. The result is the value of the parameter incremented by the smallest positive value, such that the result is not equal to the parameter within the precision of the implementation.
Thus, for all positive values of "eps",
E - eps <= subepsilon(E) < E < addepsilon(E) <= E + eps
- Parameters:
x
- float argument- Returns:
- the argument incremented by the smallest possible value
-
addepsilon
public static double addepsilon(double x) Standard Procedure addepsilon. Seeaddepsilon(float)
- Parameters:
x
- double argument- Returns:
- the argument incremented by the smallest possible value
-
subepsilon
public static float subepsilon(float x) Standard Procedure subepsilon.
procedure subepsilon(e); e; subepsilon := e - ... ; ! see below; The result type is that of the parameter. The result is the value of the parameter decremented by the smallest positive value, such that the result is not equal to the parameter within the precision of the implementation.
Thus, for all positive values of "eps",
E - eps <= subepsilon(E) < E < addepsilon(E) <= E + eps
- Parameters:
x
- float argument- Returns:
- the argument decremented by the smallest possible value
-
subepsilon
public static double subepsilon(double x) Standard Procedure subepsilon. Seesubepsilon(float)
- Parameters:
x
- double argument- Returns:
- the argument decremented by the smallest possible value
-
Char
public static char Char(int i) Standard Procedure char.
character procedure char(i); integer i; char := ... ;
The result is the character obtained by converting the parameter according to the implementation-defined coding of characters. The parameter must be in the range 0..maxrank.
- Parameters:
i
- an integer agrgument- Returns:
- the casted value: (char) i
-
_char
public static char _char(int i) Standard Procedure char. SeeChar(int)
- Parameters:
i
- an integer agrgument- Returns:
- the casted value: (char) i
-
isochar
public static char isochar(int i) Standard Procedure isochar.
character procedure isochar(i); integer i; isochar := ... ;
The result is the character obtained by converting the parameter according to the ISO 2022 standard character code. The parameter must be in the range 0..255.
- Parameters:
i
- an integer agrgument- Returns:
- the casted value: (char) i
-
rank
public static int rank(char c) Standard Procedure rank.
integer procedure rank(c); character c; rank := ... ;
The result is the integer obtained by converting the parameter according to the implementation-defined character code.
- Parameters:
c
- the argument- Returns:
- resulting rank
-
isorank
public static int isorank(char c) Standard Procedure isorank.
integer procedure isorank(c); character c; isorank := ... ;
The result is the integer obtained by converting the parameter according to the ISO 2022 standard character code.
- Parameters:
c
- the argument- Returns:
- resulting isorank
-
digit
public static boolean digit(char c) Standard Procedure digit.
Boolean procedure digit(c); character c; digit := ... ;
The result is true if the parameter is a decimal digit.
- Parameters:
c
- the argument- Returns:
- true: c is a digit
-
letter
public static boolean letter(char c) Standard Procedure letter.
Boolean procedure letter(c); character c; letter := ... ;
The result is true if the parameter is a letter of the English alphabet ('a' ... 'z', 'A' ... 'Z').
- Parameters:
c
- the argument- Returns:
- true: c is a letter
-
lowten
public static char lowten(char c) Standard Procedure lowten.
character procedure lowten(c); character c; if ... ! c is illegal as lowten; then error("..." ! Lowten error ;) else begin lowten:= CURRENTLOWTEN; CURRENTLOWTEN:= c end lowten;
Changes the value of the current lowten character to that of the parameter. The previous value is returned. Illegal parameters are
digits, plus ("+"), minus ("-"), dot ("."), comma (","), control characters (i.e. ISO code<32), DEL (ISO code 127), and all characters with ISO code greater than 127.
- Parameters:
c
- the new lowten character- Returns:
- the previous lowten character
-
illegalLowten
private static boolean illegalLowten(char c) Check if the given character is illegal as lowten.- Parameters:
c
- the given character- Returns:
- true if the given character is illegal as lowten.
-
decimalmark
public static char decimalmark(char c) Standard Procedure decimalmark.
character procedure decimalmark(c); character c; if c ne '.' and then c ne ',' then error("..." ! Decimalmark error ;) else begin decimalmark:= CURRENTDECIMALMARK; CURRENTDECIMALMARK:= c end decimalmark;
Changes the value of the decimal point character used by the text (de)editing procedures (cf. 8.7 and 8.8). See the _TXT methods: getreal, getfrac, putfix, putreal and putfrac. The previous value is returned. The only legal parameter values are dot and comma.
- Parameters:
c
- the new decimalmark character- Returns:
- the previous decimalmark character
-
copy
Standard Procedure copy.
text procedure copy(T); text T; if T =/= notext then begin text U; U.OBJ :- new TEXTOBJ(T.LENGTH,false); U.START := 1; U.LENGTH := T.LENGTH; U.POS := 1; U := T; copy :- U end copy;
"copy(T)", with T =/= notext, references a new alterable main frame which contains a text value identical to that of T.
- Parameters:
T
- the text object to be copied- Returns:
- a copy of T
-
blanks
Standard Procedure blanks.
text procedure blanks(n); integer n; if n < 0 then error("..." ! Parm. to blanks < 0;) else if n > 0 then begin text T; T.OBJ :- new TEXTOBJ(n,false); T.START := 1; T.LENGTH := n; T.POS := 1; T := notext; ! blank-fill, see 4.1.2; blanks :- T end blanks;
"blanks(n)", with n > 0, references a new alterable main frame of length n, containing only blank characters. "blanks(0)" references notext.
- Parameters:
n
- the number of space characters- Returns:
- a text object conraining n space characters
-
upcase
Standard Procedure uppercase.
text procedure upcase(t); text t; begin t.setpos(1); upcase:- t; ... end;
Convert the letters in the text parameter to their upper case representation. Only letters of the English alphabet are converted.
The result is a reference to the parameter.
- Parameters:
t
- the argument text- Returns:
- same text with upper case letters
-
lowcase
Standard Procedure lowcase.
text procedure lowcase(t); text t; begin t.setpos(1); lowcase:- t; ... end;
Convert the letters in the text parameter to their lower case representation. Only letters of the English alphabet are converted.
The result is a reference to the parameter.
- Parameters:
t
- the argument text- Returns:
- same text with lower case letters
-
sqrt
public static double sqrt(double r) Standard Procedure sqrt.- Parameters:
r
- the parameter r- Returns:
- Math.sqrt(r)
-
sin
public static double sin(double r) Standard Procedure sin.- Parameters:
r
- the parameter r- Returns:
- Math.sin(r)
-
cos
public static double cos(double r) Standard Procedure cos.- Parameters:
r
- the parameter r- Returns:
- Math.cos(r)
-
tan
public static double tan(double r) Standard Procedure tan.- Parameters:
r
- the parameter r- Returns:
- Math.tan(r)
-
cotan
public static double cotan(double r) Standard Procedure cotan.- Parameters:
r
- the parameter r- Returns:
- 1.0 / Math.tan(r)
-
arcsin
public static double arcsin(double r) Standard Procedure arcsin.- Parameters:
r
- the parameter r- Returns:
- Math.asin(r)
-
arccos
public static double arccos(double r) Standard Procedure arccos.- Parameters:
r
- the parameter r- Returns:
- Math.acos(r)
-
arctan
public static double arctan(double r) Standard Procedure arctan.- Parameters:
r
- the parameter r- Returns:
- Math.atan(r)
-
arctan2
public static double arctan2(double y, double x) Standard Procedure arctan2.- Parameters:
y
- the parameter yx
- the parameter x- Returns:
- Math.atan2(x,y)
-
sinh
public static double sinh(double r) Standard Procedure sinh.- Parameters:
r
- the parameter r- Returns:
- Math.sinh(r)
-
cosh
public static double cosh(double r) Standard Procedure cosh.- Parameters:
r
- the parameter r- Returns:
- Math.cosh(r)
-
tanh
public static double tanh(double r) Standard Procedure tanh.- Parameters:
r
- the parameter r- Returns:
- Math.tanh(r)
-
ln
public static double ln(double r) Standard Procedure ln.- Parameters:
r
- the parameter r- Returns:
- Math.log(r)
-
log10
public static double log10(double r) Standard Procedure log10.- Parameters:
r
- the parameter r- Returns:
- Math.log10(r)
-
exp
public static double exp(double r) Standard Procedure exp.- Parameters:
r
- the parameter r- Returns:
- Math.exp(r)
-
max
public static double max(double x, double y) Standard Procedure max.
procedure max(i1,i2); i1; i2; The value is the greater of the two parameter values. Legal parameter types are text, character, real type and integer type.
The type of the result conforms to the rules of 3.3.1. in Simula Standard.
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the greater of the two parameter values
-
max
public static double max(double x, float y) Standard Procedure max. Seemax(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the greater of the two parameter values
-
max
public static double max(double x, int y) Standard Procedure max. Seemax(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the greater of the two parameter values
-
max
public static float max(float x, float y) Standard Procedure max. Seemax(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the greater of the two parameter values
-
max
public static float max(float x, int y) Standard Procedure max. Seemax(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the greater of the two parameter values
-
max
public static double max(float x, double y) Standard Procedure max. Seemax(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the greater of the two parameter values
-
max
public static int max(int x, int y) Standard Procedure max. Seemax(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the greater of the two parameter values
-
max
public static float max(int x, float y) Standard Procedure max. Seemax(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the greater of the two parameter values
-
max
public static double max(int x, double y) Standard Procedure max. Seemax(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the greater of the two parameter values
-
max
public static char max(char x, char y) Standard Procedure max. Seemax(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the greater of the two parameter values
-
max
Standard Procedure max. Seemax(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the greater of the two parameter values
-
min
public static double min(double x, double y) Standard Procedure min.
procedure min(i1,i2); i1; i2; The value is the lesser of the two parameter values. Legal parameter types are text, character, real type and integer type.
The type of the result conforms to the rules of 3.3.1. in Simula Standard.
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the lesser of the two parameter values
-
min
public static double min(double x, float y) Standard Procedure min. Seemin(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the lesser of the two parameter values
-
min
public static double min(double x, int y) Standard Procedure min. Seemin(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the lesser of the two parameter values
-
min
public static float min(float x, float y) Standard Procedure min. Seemin(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the lesser of the two parameter values
-
min
public static double min(float x, double y) Standard Procedure min. Seemin(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the lesser of the two parameter values
-
min
public static float min(float x, int y) Standard Procedure min. Seemin(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the lesser of the two parameter values
-
min
public static int min(int x, int y) Standard Procedure min. Seemin(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the lesser of the two parameter values
-
min
public static float min(int x, float y) Standard Procedure min. Seemin(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the lesser of the two parameter values
-
min
public static double min(int x, double y) Standard Procedure min. Seemin(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the lesser of the two parameter values
-
min
public static char min(char x, char y) Standard Procedure min. Seemin(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the lesser of the two parameter values
-
min
Standard Procedure min. Seemin(double,double)
- Parameters:
x
- the parameter xy
- the parameter y- Returns:
- the lesser of the two parameter values
-
error
Standard Procedure error.
procedure error(t); text t; begin ... display text "t" and stop program... end error;
The procedure "error" stops the execution of the program as if a runtime error has occurred and presents the contents of the text parameter on the diagnostic channel (normally the controlling terminal).
- Parameters:
msg
- error message text
-
lowerbound
Standard Procedure lowerbound.
integer procedure lowerbound(a,i);
array a; integer i; The procedure "lowerbound" returns the lower bound of the dimension of the given array corresponding to the given index. The first dimension has index one, the next two, etc. An index less than one or greater than the number of dimensions of the given array constitutes a run time error.
- Parameters:
a
- _ARRAY referencei
- bounds index- Returns:
- the lower bound
-
upperbound
Standard Procedure upperbound.
integer procedure upperbound(a,i);
array a; integer i; The procedure "upperbound" returns the upper bound of the dimension of the given array corresponding to the given index. The first dimension has index one, the next two, etc. An index less than one or greater than the number of dimensions of the given array constitutes a run time error.
- Parameters:
a
- _ARRAY referencei
- bounds index- Returns:
- the upper bound
-
draw
Random drawing: Procedure draw.
Boolean procedure draw (a,U); name U; long real a; integer U; The value is true with the probability a, false with the probability 1 - a. It is always true if a >= 1 and always false if a <= 0.
- Parameters:
a
- The long real parameter aU
- The pseudo random number (seed) by name.- Returns:
- Returns the next pseudorandom with the probability a
-
randint
Random drawing: randint distribution.
integer procedure randint (a,b,U); name U; integer a,b,U;
The value is one of the integers a, a+1, ..., b-1, b with equal probability. If b < a, the call constitutes an error.
- Parameters:
a
- The integer parameter ab
- The integer parameter bU
- The pseudo random number (seed) by name.- Returns:
- Returns the next pseudorandom, according to the randint distribution
-
uniform
Random drawing: uniform distribution.
long real procedure uniform (a,b,U); name U; long real a,b; integer U;
The value is uniformly distributed in the interval a <= u < b. If b < a, the call constitutes an error.
- Parameters:
a
- The long real parameter ab
- The long real parameter bU
- The pseudo random number (seed) by name.- Returns:
- Returns the next pseudorandom, according to the uniform distribution
-
normal
Random drawing: normal distribution.
long real procedure normal (a,b,U); name U; long real a,b; integer U;
The value is normally distributed with mean a and standard deviation b. An approximation formula may be used for the normal distribution function.
- Parameters:
a
- The long real parameter ab
- The long real parameter bU
- The pseudo random number (seed) by name.- Returns:
- Returns the next pseudorandom, according to the negexp distribution
-
negexp
Random drawing: negexp distribution.
long real procedure negexp (a,U); name U; long real a; integer U;
The value is a drawing from the negative exponential distribution with mean 1/a, defined by -ln(u)/a, where u is a basic drawing. This is the same as a random "waiting time" in a Poisson distributed arrival pattern with expected number of arrivals per time unit equal to a.
If a is non-positive, a runtime error occurs.
- Parameters:
a
- The long real parameter aU
- The pseudo random number (seed) by name.- Returns:
- Returns the next pseudorandom, according to the negexp distribution
-
Poisson
Random drawing: Poisson distribution.
integer procedure Poisson (a,U); name U; long real a; integer U;
The value is a drawing from the Poisson distribution with parameter a. It is obtained by n+1 basic drawings, u(i), where n is the function value. n is defined as the smallest non-negative integer for which
u(0)/// u(1)/// .../// u(n) < e**(-a)
The validity of the formula follows from the equivalent condition
-ln(u(0)) - ln(u(1)) - ... - ln(u(n)) > 1
where the left hand side is seen to be a sum of "waiting times" drawn from the corresponding negative exponential distribution.
When the parameter a is greater than some implementation-defined value, for instance 20.0, the value may be approximated by entier(normal(a,sqrt(a),U) + 0.5) or, when this is negative, by zero.
- Parameters:
a
- The long real parameter aU
- The pseudo random number (seed) by name.- Returns:
- Returns the next pseudorandom, according to the Poisson distribution
-
Erlang
Random drawing: Erlang distribution.
long real procedure Erlang (a,b,U); name U; long real a,b; integer U;
The value is a drawing from the Erlang distribution with mean 1/a and standard deviation 1/(a*sqrt(b)). It is defined by b basic drawings u(i), if b is an integer value,
- ( ln(u(1)) + ln(u(2)) + ... + ln(u(b)) ) / (a*b)
and by c+1 basic drawings u(i) otherwise, where c is equal to entier(b),
- ( ln(u(1)) + ... + ln(u(c)) + (b-c)ln(u(c+1)) ) / (ab)
Both a and b must be greater than zero.
The last formula represents an approximation.
- Parameters:
a
- The long real parameter ab
- The long real parameter bU
- The pseudo random number (seed) by name.- Returns:
- Returns the next pseudorandom, according to the Erlang distribution
-
discrete
Random drawing: discrete distribution.
integer procedure discrete (A,U); name U;
array A; integer U; The one-dimensional array A, augmented by the element 1 to the right, is interpreted as a step function of the subscript, defining a discrete (cumulative) distribution function.
The function value satisfies
lowerbound(A,1) <= discrete(A,U) <= upperbound(A,1)+1.
It is defined as the smallest i such that A(i) > u, where u is a basic drawing and A(upperbound(A,1)+1) = 1.
- Parameters:
A
- a real-type arrayU
- The pseudo random number (seed) by name.- Returns:
- Returns the next pseudorandom, discrete distributed according to the array A
-
linear
Random drawing: linear distribution.
long real procedure linear (A,B,U); name U;
array A,B; integer U; The value is a drawing from a (cumulative) distribution function F, which is obtained by linear interpolation in a non-equidistant table defined by A and B, such that A(i) = F(B(i)).
It is assumed that A and B are one-dimensional arrays of the same length, that the first and last elements of A are equal to 0 and 1 respectively and that A(i) >= A(j) and B(i) > B(j) for i>j. If any of these conditions are not satisfied, the effect is implementation-defined.
The steps in the function evaluation are:
l. draw a uniform <0,1> random number, u.
- determine the lowest value of i, for which
A(i-1) <= u <= A(i)
-
compute D = A(i) - A(i-1)
-
if D = 0: linear = B(i-1) if D ne 0: linear = B(i-1) + (B(i) - B(i-1))*(u-A(i-1))/D
- Parameters:
A
- a real-type arrayB
- a real-type arrayU
- The pseudo random number (seed) by name.- Returns:
- Returns the next pseudorandom, lineary distributed according to the arrays A and B
-
histd
Utility: Procedure histd.
integer procedure histd (A,U); name U;
array A; integer U; The value is an integer in the range (lsb,usb), where lsb and usb are the lower and upper subscript bounds of the one-dimensional array A. The latter is interpreted as a histogram defining the relative frequencies of the values.
- Parameters:
A
- a real-type arrayU
- The pseudo random number (seed) by name.- Returns:
- Returns the next pseudorandom, distributed according to the array A
-
datetime
Standard Procedure datetime.
text procedure datetime; datetime :- Copy("...");
The value is a text frame containing the current date and time in the form YYYY-MM-DD HH:MM:SS.sss.... The number of decimals in the field for seconds is implementation-defined.
- Returns:
- a formated text
-
cputime
public static double cputime()Standard Procedure cputime.
long real procedure cputime;
The value is the number of processor seconds spent by the calling program.
- Returns:
- seconds since start of program
-
clocktime
public static double clocktime()Standard Procedure clocktime.
long real procedure clocktime;
- Returns:
- The value is the number of seconds since midnight.
-
histo
Standard Procedure histo.
procedure histo(A,B,c,d); real array A,B; real c,d;
Procedure statement "histo(A,B,c,d)" updates a histogram defined by the one-dimensional arrays A and B according to the observation c with the weight d. A(lba+i) is increased by d, where i is the smallest integer such that c <= B(lbb+i) and lba and lbb are the lower bounds of A and B respectively. If the length of A is not one greater than that of B the effect is implementation-defined. The last element of A corresponds to those observations which are greater than all elements of B.
- Parameters:
A
- real array aB
- real array bc
- real value cd
- real value d
-
argv
Extended Standard procedure argv.- Parameters:
index
- case index- Returns:
- requested text info
-
exit
public static void exit(int status) Extended Standard procedure exit.- Parameters:
status
- exit status
-
edit
Extended Standard procedure edit.- Parameters:
n
- the argument- Returns:
- the edited text
-
edit
Extended Standard procedure edit.- Parameters:
n
- the argument- Returns:
- the edited text
-
edit
Extended Standard procedure edit.- Parameters:
n
- the argument- Returns:
- the edited text
-
edit
Extended Standard procedure edit.- Parameters:
n
- the argument- Returns:
- the edited text
-
edit
Extended Standard procedure edit.- Parameters:
n
- the argument- Returns:
- the edited text
-
edit
Extended Standard procedure edit.- Parameters:
n
- the argument- Returns:
- the edited text
-
edfix
Extended Standard procedure edit.- Parameters:
r
- the real argumentn
- number of digits after decimal sign- Returns:
- the edited text
-
edfix
Extended Standard procedure edit.- Parameters:
r
- the real argumentn
- number of digits after decimal sign- Returns:
- the edited text
-
edtime
Edit simulated time.- Parameters:
hours
- simulated time- Returns:
- the edited text
-
edtime
Edit simulated time.- Parameters:
hours
- simulated time- Returns:
- the edited text
-
waitSomeTime
public static void waitSomeTime(int millies) Extended Standard procedure waitSomeTime.- Parameters:
millies
- wait time in millisecods
-
printThreadList
public static void printThreadList(boolean withStackTrace) Extended Standard procedure printThreadList.- Parameters:
withStackTrace
- true: if stacktrace is wanted
-
printStaticChain
public static void printStaticChain()Extended Standard procedure printStaticChain.
-
DEFEXCEPTION
S-PORT Extension Procedure DEFEXCEPTION.
Register an EXCEPTION_HANDLER to be used by the runtime system when a runtime error occur.
- Parameters:
EXCEPTION_HANDLER
- the argument
-
hash
S-PORT Extension Procedure hash.- Parameters:
txt
- the argument- Returns:
- resulting hash value
-
loadChar
Text Extension Procedure loadChar.
Load a character from a text.
- Parameters:
t
- a text referencep
- the text position in which the character is stored- Returns:
- the character at position p
-
storeChar
Text Extension Procedure storeChar.
Store character into a text.
- Parameters:
c
- a charactert
- a text referencep
- the text position in which the character is stored
-