Constants
A constant data type is determined by its syntax. In PV-WAVE there are eight basic data types, each with its own form of constant:
BYTE—8-bit unsigned integers.
INT—16-bit signed integers.
INT32—32-bit signed integers.
LONG—64-bit signed integers on 64-bit platforms; 32-bit signed integers on all other platforms.
FLOAT—32-bit single-precision floating-point.
DOUBLE—64-bit double-precision floating-point.
COMPLEX—Real-imaginary pair using single-precision floating-point.
DCOMPLEX—Real-imaginary pair using double-precision floating-point.
STRING—Zero or more eight-bit characters which are interpreted as text.
Integer Constants
Numeric constants of different types may be represented by a variety of forms. The syntax of integer constants is shown in the following table, where “n” represents one or more digits.
Values of integer constants can range from 0 to 255 for BYTEs, 0 to ± 32,767 for INTs, 0 to ± 232 for INT32s, and 0 to ± 232 (on 32-bit systems) or 0 to ± 264 (on 64-bit systems) for LONGs. Integers that are initialized with absolute values greater than 32,767 are automatically typed as longword. Any numeric constant may be preceded by a + or a – sign. To ensure cross-platform compatibility, place the + or a – sign outside of the apostrophe.
Floating-point and Double-precision Constants
Floating-point and double-precision constants may be expressed in conventional or scientific notation. Any numeric constant that includes the decimal point is a floating-point or double-precision constant.
The syntax of floating-point and double-precision constants is shown in
Table 3-4: Syntax of Floating-point and Double-precision Constants. The notation
sx represents the sign and magnitude of the exponent, for example:
E-2.
Double-precision constants are entered in the same manner, replacing E with a D. For example, 1.0D0, 1D, 1.D, all represent a double precision one.
Complex Constants
Complex constants contain a real and an imaginary part, which can be of single or double-precision floating point numbers. The imaginary part may be omitted, in which case it is assumed to be zero.
The form of a complex constant is:
COMPLEX(real_part, imaginary_part)
or:
COMPLEX(real_part)
For example, COMPLEX(1, 2), is a complex constant with a real part of one, and an imaginary part of two. COMPLEX(1)is a complex constant with a real part of one and a zero imaginary component.
The ABS function returns the magnitude of a complex expression. To extract the real part of a complex expression, use the FLOAT function; to extract the imaginary part, use the IMAGINARY function. These functions are explained in the PV‑WAVE Reference.
String Constants
A string constant consists of zero or more characters enclosed by apostrophes ( ' ) or quotation marks ( " ). The value of the constant is simply the characters appearing between the leading delimiter ( ' or " ) and the next occurrence of the delimiter.
A double apostrophe ( ' ' ) or double quotation mark ( " " ) is considered to be the null string; a string containing no characters.
An apostrophe or quotation mark may be represented within a string that is delimited by the same character, by two apostrophes, or quotation marks. For example, 'Don''t' produces Don't; or you can write: "Don't" to produce the same result.