HTBasic Help
×
Menu
Index

Real

 
"Real" is a data type. Other data types are integer, long, complex, string, and I/O path. The Real data type is a subset of all rational numbers. The particular subset depends on your computer. Most computers, including the IBM PC, use IEEE Std 754-1985 for Binary Floating point numbers. This gives the Real data type an approximate range of 2E-308 to 1E+308 and 15 decimal digits of precision. Both positive and negative numbers are represented. MINREAL and MAXREAL are functions which return the smallest and largest positive real numbers. The range for negative numbers is -MINREAL to -MAXREAL.
Use the REAL statement to declare local real variables and the COM statement to declare global real variables and STATIC variables to declare persistent variables. Use the ALLOCATE statement to declare a local real variable which can be DEALLOCATEd dynamically. If a variable is not declared, it will automatically be declared local and real unless CONFIGURE DIM OFF is used.
Please Note: Internally real numbers are represented in a binary format (explained in the Users Guide). You need not understand this format, but you should understand its implications. It is possible to have two different numbers in this format whose 15 digit decimal representations are the same. However, when comparing or subtracting these two "look-equal" numbers, you will find they are not equal. Also, when the result of an arithmetic operation is a number not representable in the binary format, an approximation must be used instead. You should take this into account and keep track of the error bounds as approximate numbers are used in further calculations.