next up previous contents index
Next: User-Defined Functions Up: The Xic Scripting Language Previous: ``Preprocessor'' Directives   Contents   Index


Math Functions

The following math functions are defined internally.

Name Returns
abs(x) absolute value of x
acos(x) arc-cosine of x
acosh(x) arc-hyperbolic cosine of x
asin(x) arc-sine of x
asinh(x) arc-hyperbolic sine of x
atan(x) arc-tangent of x
atan2(x, y) arc tangent of x, y
atanh(x) arc-hyperbolic tangent of x
ceil(x) smallest integer > = x
cos(x) cosine of x
cosh(x) hyperbolic cosine of x
exp(x) e to the x power
floor(x) largest integer < = x
gauss() gaussian random number
int(x) truncated integer value of x
ln(x) natural logarithm of x
log(x) natural logarithm of x, see below
log10(x) base 10 logarithm of x
max(x, y) largest of x, y
min(x, y) smallest of x, y
random() random value in [0, 1)
rint(x) integer nearest to x
seed(x) seed random number generator
sgn(x) +1, 0, - 1 if x > 0, x = 0, x < 0
sin(x) sine of x
sinh(x) hyperbolic sine of x
sqrt(x) square root of x
tan(x) tangent of x
tanh(x) hyperbolic tangent of x

These functions behave as do the corresponding functions in the C library, though the random number functions are specialized to Xic. The seed function applies a seed value to the random number generators. This can be used to ensure that successive runs using random numbers choose different values. The seed value given is converted to an integer before use. The random function returns a random value in the range [0 - - 1). The numbers generated have a uniform distribution. The gauss function returns Gaussian random numbers with zero mean and unit deviation.

Note regarding the log function
In Xic releases prior to 3.2.23, the log function returned the base-10 logarithm. This definition was changed in 3.2.23, and the log10 function added, for consistency with programming languages, WRspice, and most other software. This will require users to update legacy scripts that use the log function to call log10 instead. However, there is a LogIsLog10 variable that can be set to revert log to base-10. This can be used temporarily, but is not recommended for the long-term.


next up previous contents index
Next: User-Defined Functions Up: The Xic Scripting Language Previous: ``Preprocessor'' Directives   Contents   Index
Stephen R. Whiteley 2012-04-01