Expression syntax
Binary operators:
- + addition
- - subtraction
- * multiplication
- / division
- ^ exponentiation
Unary operators:
- + unary plus
- - unary minus
Functions:
- abs(x) absolute value
- acos(x) inverse cosine
- acosh(x) inverse hyperbolic cosine
- asin(x) inverse sine
- asinh(x) inverse hyperbolic sine
- atan(x) inverse tangent
- atanh(x) inverse hyperbolic tangent
- ceil(x) ceiling (the smallest integer greater than or equal to x)
- cos(x) cosine
- cosh(x) hyperbolic cosine
- exp(x) exponential (the constant e raised to the power x)
- floor(x) floor (the greatest integer less than or equal to x)
- lg(x) base 2 logarithm
- ln(x) natural (i.e. base e) logarithm
- log(x) base 10 logarithm
- rand(x) random number between 0 and 1 (the value of x has no effect)
- randn(x) a random number normally distributed with mean 0 and
standard deviation 1
- randseed(x) sets the seed for the random number generator
- round(x) rounds x to the closest integer
- sin(x) sine
- sqrt(x) square root
- tan(x) tangent
- tanh(x) hyperbolic tangent
Constants:
- pi 3.141...
- e 2.718... i.e. exp(1)
Syntax:
- expression = term +- term +- ... +- term
where +- means either a + or a - sign
- term = powerfactor */ powerfactor */ ... */ powerfactor
where */ means either a * or a / sign
- powerfactor = factor ^ factor ^ ... ^ factor
exponentiation groups left to right (as usually), i.e. a^b^c means (a^b)^c
- factor = number, or
- factor = name, or
- factor = functionname ( expression ), or
- factor = ( expression ), or
- factor = +- term
where +- means either an unary plus or an unary minus
Last updated June 6, 1996.
Copyright © 1996 by Harri Ojanen.
Back to Java programs