Expressions

In general, any mathematical expression accepted by C, FORTRAN, Pascal, or BASIC is valid. The precedence of these operators is determined by the specifications of the C programming language. White space (spaces and tabs) is ignored inside expressions.

Complex constants are expressed as {<real>,<imag>}, where <real> and <imag> must be numerical constants. For example, {3,2} represents 3 + 2i; {0,1} represents i itself. The curly braces are explicitly required here.

Note that gnuplot uses both ``real'' and ``integer'' arithmetic, like FORTRAN and C. Integers are entered as ``1'', ''-10'', etc; reals as ``1.0'', ''-10.0'', ``1e1'', 3.5e-1, etc. The most important difference between the two forms is in division: division of integers truncates: 5/2 = 1; division of reals does not: 5.0/2.0 = 2.5. In mixed expressions, integers are ``promoted'' to reals before evaluation: 5/2e1 = 2.5. The result of division of a negative integer by a positive one may vary among compilers. Try a test like ``print -5/2'' to determine if your system chooses -2 or -3 as the answer.

The real and imaginary parts of complex expressions are always real, whatever the form in which they are entered: in {3,2} the ``3'' and ``2'' are reals, not integers.


Subsections