Condividi tramite


Double Field Type

When you need more accuracy, such as for a fixed amount of storage in your table or true floating-point values, use the Double data type instead of Numeric. For specifications about the Double field type, see Visual FoxPro Data and Field Types.

In a table, unlike Numeric data, you determine the position of the decimal point when you enter the value.

When the Double data type is used in a table, the number of decimals specified is for presentation purposes only. Visual FoxPro stores the real value.

The following example illustrates this behavior:

#define xml_name 'myxmlfile.xml'
#define database_name 'xmldatabase'
#define table_name 'xmltable'

&& Closes old database
CLOSE DATABASES ALL
CLEAR

&& Deletes database if it exists
IF FILE(database_name) THEN
   DELETE DATABASE (database_name) deletetables
ENDIF

&& Creates a new database
CREATE DATABASE (database_name)

CREATE TABLE (table_name) (myfield B(2))

INSERT INTO (table_name) VALUES (1234.561234)

? EVALUATE(table_name+".myfield")
? EVALUATE(table_name+".myfield") = 1234.56
? EVALUATE(table_name+".myfield") = 1234.561234

See Also

Data and Field Types | Visual FoxPro Data and Field Types |

Numeric Expression Creation | Numeric Operators |