When you need more accuracy, for example, when you have a fixed amount of storage in your table or true floating-point values, use the Double data type instead of Numeric. Unlike with numeric data, you determine the position of the decimal point when you enter the value in a table.
Note: |
|---|
| When the Double data type is used in a table, the number of decimals specified when the field is created is for display purposes only. Visual FoxPro stores the actual value in the field. |
For specifications about the Double field type, see Visual FoxPro Data and Field Types.
Example
The following example creates a cursor with a Double field and specifies 2 digits of precision for the field. The field displays only 2 digits of precision even though the value contains more than 2 digits of precision.
| В | Copy Code |
|---|---|
&& Close any open databases and clear memory.
CLOSE DATABASES ALL
CLEAR
&& Create a cursor with field of Double type.
CREATE CURSOR myCursor (myField B(2))
&& Insert value into cursor.
INSERT INTO myCursor VALUES (1234.561234)
&& Evaluate and display value in myField.
? EVALUATE("myCursor.myField") && Displays 1234.56.
&& Evaluate and compare values to determine actual value.
? EVALUATE("myCursor.myField") = 1234.56 && Displays .F.
? EVALUATE("myCursor.myField") = 1234.561234 && Displays .T. | |
js editor
Web development
Note: