Partager via


Currency Data Type

To store monetary values or precise financial calculations, use the Currency data type instead of Numeric.

Tip

You can convert values from Numeric to Currency and the reverse using the NTOM( ) and MTON( ) functions. For more information, see Numeric Data Type, NTOM( ) Function, and MTON( ) Function.

To assign the Currency data type, use the dollar sign:

money = $50.33
moremoney = $675.43886

If you specify more than four decimal places in a currency expression, Visual FoxPro rounds to the expression to four places before evaluating the expression. In the example, the variable moremoney is internally rounded to 675.4389.

Currency fields respect system settings, such as SET CURRENCY, when displayed in Browse windows, fields, or when listed to the screen.

For more specifications about the Currency data type, see Visual FoxPro Data and Field Types.

See Also

Tasks

How to: Choose Data Types

Reference

SET CURRENCY Command

Other Resources

Data and Field Types