Next: , Up: Math And Text Utilities   [Index]


13.1.1 Math And Text Functions

All text comparison functions are case sensitive, unless otherwise specified.

Gacos

real Gacos(real x);

is the in degrees specified arc cosine of x

Gadiff

real Gadiff(real x, real y);

is the in degrees specified smallest angle between degrees x and degrees y (or something)

Garccos

real Garccos(real x);

is same as ‘Gacos’(x)

Garcctg2

real Garcctg2(real x, real y);

is the in degrees specified arc tangent of y / x, signs of both x and y being used to determine the quadrant of the result (same as ‘Gatan2’(y, x))

Garcdiff

real Garcdiff(real x, real y);

is same as ‘Gadiff’(x, y)

Garcsin

real Garcsin(real x);

is same as ‘Gasin’(x)

Garctg

real Garctg(real x);

is same as ‘Gatan’(x)

Garctg2

real Garctg2(real y, real x);

is same as ‘Gatan2’(y, x)

Gasin

real Gasin(real x);

is the in degrees specified arc sine of x

Gatan

real Gatan(real x);

is the in degrees specified arc tangent of x

Gatan2

real Gatan2(real y, real x);

is the in degrees specified arc tangent of y / x, signs of both x and y being used to determine the quadrant of the result

Gcos

real Gcos(real x);

is the cosine of degrees x

Gparcctg2

real Gparcctg2(real x, real y);

is the positively defined, in radians specified arc tangent of y / x, signs of both x and y being used to determine the quadrant of the result (same as ‘Gpatan2’(y, x))

Gparctg2

real Gparctg2(real y, real x);

is same as ‘Gpatan2’(y, x)

Gpatan2

real Gpatan2(real y, real x);

is the positively defined, in degrees specified arc tangent of y / x, signs of both x and y being used to determine the quadrant of the result

Gsin

real Gsin(real x);

is the sine of degrees x

Gtan

real Gtan(real x);

is the tangent of degrees x

Gtg

real Gtg(real x);

is same as ‘Gtan’(x)

abs

integer abs(integer m);

is the absolute value of m

acos

real acos(real x);

is the in radians specified arc cosine of x

adiff

real adiff(real x, real y);

is the in radians specified smallest angle between radians x and radians y (or something)

aleph

cardinal aleph(text s, integer x);

is the base x integral interpretation of s. s is expected some sequence of base x digit characters. In bases above 10, the letter ‘a’ in either upper or lower cases represents 10, ‘b’ represents 11, and so forth, with ‘z’ representing 35. x is expected between 2 and 36 inclusive. Or zero, in which case the base is assumed 16 if the digits sequence is immediately prefixed by ‘0x’, 8 if the sequence starts with ‘0’, 10 otherwise.

alpha

integer alpha(text s, integer x);

is the base x integral interpretation of s. s is expected some sequence of base x digit characters, possibly prefixed by a mix of white spaces and sign characters (i.e. minuses and pluses). In bases above 10, the letter ‘a’ in either upper or lower cases represents 10, ‘b’ represents 11, and so forth, with ‘z’ representing 35. x is expected between 2 and 36 inclusive. Or zero, in which case the base is assumed 16 if the digits sequence is immediately prefixed by ‘0x’, 8 if the sequence starts with ‘0’, 10 otherwise.

arccos

real arccos(real x);

is same as ‘acos’(x)

arcctg2

real arcctg2(real x, real y);

is the in radians specified arc tangent of y / x, signs of both x and y being used to determine the quadrant of the result (same as ‘atan2’(y, x))

arcdiff

real arcdiff(real x, real y);

is same as ‘adiff’(x, y)

arcsin

real arcsin(real x);

is same as ‘asin’(x)

arctg

real arctg(real x);

is same as ‘atan’(x)

arctg2

real arctg2(real y, real x);

is same as ‘atan2’(y, x)

asin

real asin(real x);

is the in radians specified arc sine of x

atan

real atan(real x);

is the in radians specified arc tangent of x

atan2

real atan2(real y, real x);

is the in radians specified arc tangent of y / x, signs of both x and y being used to determine the quadrant of the result

atof

real atof(text s);

is the real decimal interpretation of s. s is expected some sequence of decimal digit characters, possibly including a single period sign (‘.’), though not in last position, possibly prefixed (the sequence, not the characters) by some mix of white spaces and sign characters (minuses and pluses, that is).

atoi

integer atoi(text s);

is the integral decimal interpretation of s. s is expected some sequence of decimal digit characters, possibly prefixed (the sequence, not the characters) by some mix of white spaces and sign characters (minuses and pluses, that is). Same as ‘alpha’(s, 10).

aton

cardinal aton(text s);

is the cardinal decimal interpretation of s. s is expected some sequence of decimal digit characters, possibly prefixed (the sequence, not the characters) by some white spaces.

base2

integer base2(integer m);

is the greatest power of 2 less than or equal to m if m is not less than zero, some undefined value otherwise

basename

text basename(text s);

is the basename of s, what follows the last occurring ‘/

bcount

integer bcount(integer m);

is the m bitcount (i.e. the number of bits set in m)

breverse

integer breverse(integer m);

is the bit reversed m

bfxa

text bfxa(integer b, integer f, integer x, integer m);

is the base x, f digits, b wide comma separated blocks representation of m

bfxcardinal

text bfxcardinal(integer b, integer f, integer x, cardinal z);

is the base x, f digits, b wide comma separated blocks representation of z

bfxinteger

text bfxinteger(integer b, integer f, integer x, integer m);

is the base x, f digits, b wide comma separated blocks representation of m (same as ‘bfxa’(b, f, x, m))

cat

text cat(text s1, text s2);

is the concatenation of s1 and s2

cat2

text cat2(text s1, text s2);

is same as ‘cat’(s1, s2)

cat3

text cat3(text s1, text s2, text s3);

is the concatenation of s1, s2 and s3

cat4

text cat4(text s1, text s2, text s3, text s4);

is the concatenation of s1, s2, s3 and s4

cardinal

cardinal cardinal(cardinal z);

is z

ceil

real ceil(real x);

is the up rounded value of x

character

integer character(text s, integer m);

is the (positively defined value of the) mth character of s, if such character exists, 0 otherwise (negative item indications are interpreted with respect to the end of string)

See Negative Indices.

compare

integer compare(text s, text t);

is 0 if s is same as t, less than 0 if s is less than t and greater than 0 if s is greater than t

cos

real cos(real x);

is the cosine of radians x

cut

text cut(text string, integer offset, integer length);

is the length long (shorter if fewer characters are available) substring starting from offset in string if offset is a valid position indication, s otherwise (negative position indications are interpreted with respect to the end of string). A negative length is taken as 0.

deck2

integer deck2(integer m);

is the lesser power of 2 greater than or equal to m if m is not less than zero, some undefined value otherwise

delete

text delete(text s, integer p);

is the p indexed character deleted s string (negative item indications are interpreted with respect to the end of string) if p is a valid item indication, s otherwise

See Negative Indices.

digit

cardinal digit(text s, integer x);

is the base x integral interpretation of s. s is expected some sequence of base x digit characters. In bases above 10, the letter ‘a’ in either upper or lower cases represents 10, ‘b’ represents 11, and so forth, with ‘z’ representing 35. x is expected between 2 and 36 inclusive. Or zero, in which case the base is assumed 16 if the digits sequence is immediately prefixed by ‘0x’, 8 if the sequence starts with ‘0’, 10 otherwise.

drand

integer drand(integer m);

is a pseudo-random integer between inclusive 0 and m

echo

text echo(text s);

is s

eq_t

integer eq_t(text s, text t);

is 0 if s is not same as t, not zero otherwise (same as s == t)

erase

text erase(text s, integer p, integer q);

is the p to q indexed characters deleted s string (negative item indications are interpreted with respect to the end of string) if p and q are valid item indications, s otherwise

See Negative Indices.

exp

real exp(real x);

is the value of e (the base of natural logarithms) raised to the power of x

exp2

real exp2(real x);

is the value of 2 raised to the power of x

fabs

real fabs(real x);

is the absolute value of x

fclip

real fclip(real min, real x, real max);

is the minimum between max and the maximum between x and min (same as ‘gclip’(x, min, max))

ffs

integer ffs(integer m);

is the 1 based position of the first (least significant) bit set in m if any, 0 otherwise

figs

integer figs(cardinal a, integer b);

is the number of figures of a representation in base b

finteger

text finteger(integer m, integer f);

is the f digits decimal representation of m (same as ‘itoa_f’)

floor

real floor(real x);

is the down rounded value of x

fls

integer fls(integer m);

is the 1 based position of the last (most significant) bit set in m if any, 0 otherwise

fmax

real fmax(real x, real y);

is the maximum of x and y

fmin

real fmin(real x, real y);

is the minimum of x and y

fmod

real fmod(real x, real y);

is the remainder of dividing x by y, more specifically x - n * y, where n is the quotient of x / y, rounded toward zero to an integer

fmodf

real fmodf(real x);

is the same sign as x fractional part of x

frame

integer frame(text s, integer c);

is the position of the last occurrence of the c non zero character in the s string if any, -1 otherwise

frand

real frand(void);

is a pseudo-random real between 0 and 1

frexp

real fsign(real x, integer &e);

is the (-1; -0.5], [0.5; 1) normalized fraction that multiplied by the power of two to which e is set retrieves x

fsign

real fsign(real x);

is -1 if x is negative, 0 of x is zero, 1 otherwise

gcd

integer gcd(integer m, integer n);

is the greatest common denominator of m and n

gclip

real gclip(real x, real min, real max);

is the minimum between max and the maximum between x and min (same as ‘fclip’(min, x, max))

ge_t

integer ge_t(text s, text t);

is 0 if s is not greater than or same as t, not zero otherwise (same as s >= t)

gt_t

integer gt_t(text s, text t);

is 0 if s is not greater than t, not zero otherwise (same as s > t)

iclip

integer iclip(integer min, integer m, integer max);

is the minimum between max and the maximum between m and min (same as ‘jclip’(m, min, max))

icompare

integer icompare(text s, text t);

is 0 if s is (case insensitive) same as t, non 0 otherwise

imatch

integer imatch(text s, text t);

is 0 if t wild card (case insensitive) matches the s pattern (the * and ? literal sign are interpreted as for their shell pattern equivalents), non 0 otherwise

imodf

real imodf(real x);

is the same sign as x integral part of x

initial

integer initial(text s);

is the first character of s, if such character exists, 0 otherwise

insert

text insert(text s, integer p, integer c);

is the before p indexed character c character inserted s string (negative position indications are interpreted with respect to the end of string) if p is a valid position indication, s otherwise

integer

integer integer(integer m);

is m

irand

integer irand(integer m, integer n);

is a pseudo-random integer between inclusive m and n

itoa

text itoa(integer m);

is the decimal representation of m

itoa_f

text itoa_f(integer m, integer f);

is the f digits decimal representation of m (same as ‘finteger’)

jclip

integer jclip(integer m, integer min, integer max);

is the minimum between max and the maximum between m and min (same as ‘iclip’(min, m, max))

kfs

integer kfs(integer m, integer k);

is the 0 based least significant position of the first least significant kth bit set in m if any, the number of bits in m otherwise. k 0 selects the first set bit, 1 the second, etc. ‘kfs’(m, 0) is equivalent with ‘xfs’(m).

kls

integer kls(integer m, integer k);

is the 0 based most significant position of the first most significant kth bit set in m if any, the number of bits in m otherwise. k 0 selects the first set bit, 1 the second, etc. ‘kls’(m, 0) is equivalent with ‘xls’(m).

le_t

integer le_t(text s, text t);

is 0 if s is not less than or same as t, not zero otherwise (same as s <= t)

length

integer length(text s);

is the length of s

limit

real limit(real x);

is the away from zero rounded value of x

ln

real ln(real x);

is same as ‘log’(x)

log

real log(real x);

is the natural logarithm of x

log10

real log10(real x);

is the base 10 logarithm of x

log2

real log2(real x);

is the base 2 logarithm of x

lrand

real lrand(void);

is a pseudo-random real between -1 and 1

lt_t

integer lt_t(text s, text t);

is 0 if s is not less than t, not zero otherwise (same as s < t)

lz

integer lz(integer m);

is the m leading zero bits count, same as ‘xls’(m)

match

integer match(text s, text t);

is 0 if t wild card matches the s pattern (the * and ? literal sign are interpreted as for their shell pattern equivalents), non 0 otherwise

max

integer max(integer m, integer n);

is the maximum of m and n

min

integer min(integer m, integer n);

is the minimum of m and n

modf

real modf(real x, real &y);

is the same sign as x fractional part of x, sets y as the same sign as x integral part of x

ne_t

integer ne_t(text s, text t);

is 0 if s is same as t, not zero otherwise (same as s != t)

ntoa

text ntoa(cardinal z);

is the decimal representation of z

parcctg2

real parcctg2(real x, real y);

is the positively defined, in radians specified arc tangent of y / x, signs of both x and y being used to determine the quadrant of the result (same as ‘patan2’(y, x))

parctg2

real parctg2(real y, real y);

is same as ‘patan2’(y, x)

patan2

real patan2(real y, real x);

is the positively defined, in radians specified arc tangent of y / x, signs of both x and y being used to determine the quadrant of the result

place

integer place(text s, integer c);

is the position of the first occurrence of the c non zero character in the s string if any, -1 otherwise

pow

real pow(real x, real y);

is the value of x raised to the power of y

prefix

integer prefix(text s, text t);

is the number of characters matching at the beginning of s and t (the length of the longest common prefix)

project

text project(text s, integer m);

is s after position m (negative position indications are interpreted with respect to the end of string, m is clipped to fall inside s)

See Negative Indices.

real

real real(real x);

is x

srand

void srand(integer m);

seeds the pseudo-random sequence with m

The pseudo-random sequence is seeded before any call to the random number generators with a system derived value that is not likely to repeat much.

round

real round(real x);

is the nearest integer, half cases away from zero rounded value of x

sign

integer sign(integer m);

is -1 if m is negative, 0 of m is zero, 1 otherwise

signed

integer signed(cardinal z);

is z

sin

real sin(real x);

is the sine of radians x

sq

real sq(real x);

is the square of x

sqrt

real sqrt(real x);

is the square root of x

tan

real tan(real x);

is the tangent of radians x

tg

real tg(real x);

is same as ‘tan’(x)

track

real track(real x);

is the towards zero rounded value of x

tz

integer tz(integer m);

is the m trailing zero bits count, same as ‘xfs’(m)

unsigned

cardinal unsigned(integer m);

is m

xfs

integer xfs(integer m);

is the 0 based position of the first (least significant) bit set in m if any, the number of bits in m otherwise (same as ‘tz’(m))

xls

integer xls(integer m);

is the 0 based position of the last (most significant) bit set in m if any, the number of bits in m otherwise (same as ‘lz’(m))


Next: Arithmetic Functions, Up: Math And Text Utilities   [Index]