|
Firstly, I think the OP's premise is
incorrect. If VAR.1 = 52.6766 and he wants to round to 2 decimal
places, the result would be 52.68, NOT 52.65. If VAR.1 = 52.6466,
the result would be 52.65, not 52.60. Second, X=INT(X*20+.5)/20 returns 52.7 (1 decimal place), and is a little hard to interpret. Any time I do this, I always have to think about what to multiply and divide by. I use this form: Round to 1, then 2 decimal places (work with the OCONV version). If I goofed something up here, let me know. Code: VAR.1 = 52.6466 VAR.1.ROUNDED.1 = VAR.1 1 VAR.1.ROUNDED.2 = VAR.1 2 X = INT(VAR.1 * 20 + .5) / 20 * CRT 'VAR.1 = ': VAR.1 CRT 'VAR.1.ROUNDED.1 = ': VAR.1.ROUNDED.1 CRT 'VAR.1.ROUNDED.2 = ': VAR.1.ROUNDED.2 CRT 'X = ': X * VAR.1 = 52.6766 VAR.1.ROUNDED.1 = VAR.1 1 VAR.1.ROUNDED.2 = VAR.1 2 X = INT(VAR.1 * 20 + .5) / 20 * CRT 'VAR.1 = ': VAR.1 CRT 'VAR.1.ROUNDED.1 = ': VAR.1.ROUNDED.1 CRT 'VAR.1.ROUNDED.2 = ': VAR.1.ROUNDED.2 CRT 'X = ': X Result: VAR.1 = 52.6466 VAR.1.ROUNDED.1 = 52.6 VAR.1.ROUNDED.2 = 52.65 X = 52.65 VAR.1 = 52.6766 VAR.1.ROUNDED.1 = 52.7 VAR.1.ROUNDED.2 = 52.68 X = 52.7 Using the scaling format works every time, and no thinking. Just my $.02 worth.
Charlie Noah The views and opinions expressed herein are my own (Charlie Noah) and do not necessarily reflect the views, positions or policies of any of my former, current or future employers, employees, clients, friends, enemies or anyone else who might take exception to them. On 11-11-2010 12:14 PM, Simon Verona wrote: -- Please read the posting guidelines at: http://groups.google.com/group/jBASE/web/Posting%20Guidelines IMPORTANT: Type T24: at the start of the subject line for questions specific to Globus/T24 To post, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jBASE?hl=en |
<<attachment: cwnoah.vcf>>
