Skip to content

Real

See Also: Declaring Variables, Variable Declaration Commands, Struct, Integer, Number, Real Function

Purpose

Declares one or more Real (floating-point numeric) variables.

Syntax

To declare real variables

Real {identifier} [{identifier}]

Where:

  • {identifier} is the name of a new Real variable.
  • {identifier} may be between 1 and 4096 characters in length, must start with a letter, and may not contain spaces. Recommended characters are 0-9, a-z, A-Z, and _ (underscore).

To declare array variables of type Real

Real {dimension-list} {identifier} [{identifier}]

Where:

  • {dimension-list} is a list of one or more array dimensions for the array. A dimension list is declared using square brackets []. One pair of brackets is used to declare each dimension. If the array is static, then you must specify the static size of each dimension between each pair of brackets, i.e., [{size}]. For more information about declaring arrays, refer to Array Variable Assignments.
  • {identifier} may be between 1 and 4096 characters in length, must start with a letter, and may not contain spaces. Recommended characters are 0-9, a-z, A-Z, and _ (underscore).

What It Does

Real defines in-memory variables that are to contain numeric type data in floating-point format. Real variables allow for 16 significant digits and an order of magnitude of ±306. A Real variable can have any value in the range of ±9.999999999999999 * 10^±306.

Multiple variables may be declared on one command line, with their names separated from each other by spaces.

Examples

Procedure DoTheMath
    Real rAsymptote rGradient rAbscissa
End_Procedure

In this example, three Real variables, rAsymptote, rGradient, and rAbscissa, are declared.

Real[] rBattingAverages

This example declares one dynamic array variable, named rBattingAverages, containing an undefined number of elements of type Real.

Real[5] rBattingAverages

This example declares one static array variable, named rBattingAverages, containing 5 elements of type Real.

Real[][3] rBattingAverages

This example creates a two-dimensional dynamic array variable named rBattingAverages, containing an undefined number of elements of type Real. Conceptually, this represents a rectangular array with an undefined number of rows, each of 3 columns.

You can declare dynamic multi-dimensional arrays where all dimensions are dynamic; these are called jagged arrays.

Notes

  • When a calculation exceeds the capacity of Real variables, error 59 is triggered.
  • The show and showln commands display values of absolute ten million or more, and one ten-millionth and less in scientific notation. For example, ten million is displayed as 1e+007. One ten-millionth is displayed as 1e-007.
  • The Real type is not supported in the database. If a Real variable is moved to a Number database element, its value is converted to the format of the Number data type. If the value of such a variable exceeds the range of Number, a value-range error is triggered. Data entry in Real format can be supported by addressing a Real variable through the entry_item command.
  • If you need to define a global Real variable, you should use the global_variable command to do so.