HTBasic Help
×
Menu
Index

COMPLEX

 
"Complex" is a data type. A complex number is an ordered pair (x, y) denoted by mathematically as: x + iy where x is the real part of the complex number, y is the imaginary part together with i, which is defined as the square root of -1, or (-1^(1/2)).
 
For example, the square root of -9 or, -9^(1/2) could be considered as the -1^(1/2) x 9^(1/2) or 3i.
 
In HTBasic, complex numbers are stored as two REAL numbers.
 
Note that MINREAL and MAXREAL are functions which return the smallest and largest positive real numbers. So, the range for negative numbers is -MINREAL to -MAXREAL.
 
Use COMPLEX to declare local complex variables and the COM statement to declare global complex variables. Use the ALLOCATE statement to declare a local complex variable which you can DEALLOCATE dynamically. If a variable is not declared, it will automatically be declared local and real unless CONFIGURE DIM OFF is used.