Using SET DECIMALS and ROUND() for Specific # of DecimalsLast reviewed: June 27, 1995Article ID: Q96359 |
The information in this article applies to:
SUMMARYThe SET DECIMALS command sets the minimum number of decimal places that will be displayed as a result of numeric functions and calculations. This setting will behave differently according to what operations are being performed. To ensure the output displays a specific number of decimal places, the ROUND() function should be used.
MORE INFORMATION
Sample Code
a=1.2 b=1.1 SET DECIMALS TO 1 ?a*b ?a/b SET DECIMALS TO 4 ?a*b ?a/b ?ROUND(a*b,1) ?ROUND(a/b,1) ?ROUND(a*b,4) ?ROUND(a/b,4)With SET DECIMALS TO 1, the expression a*b results in 1.32, and a/b results in 1.1. With SET DECIMALS TO 4, a*b results in 1.32 and a/b results in 1.0909. However, ROUND(a*b,1) results in 1.3, and ROUND(a/b,1) results in 1.1. Similarly, ROUND(a*b,4) results in 1.3200 and ROUND(a/b,4) results in 1.0909.
REFERENCES"Language Reference," version 2.5, pages L3-836, L3-911 "Commands & Functions," version 2.0, pages C3-677, C3-740 "Commands & Functions," version 1.02, pages C3-291, C4-172
|
Additional reference words: FoxDos FoxWin 1.02 2.00 2.50 2.50a
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |