|
The (R) extender to the eval is important if you have large fields being multiplied or divided, especially where multiple fields are being combined in a single expression. You may lose precision in your answer if you don't use the (R) extender. Consider the follwing example: d A s 5 2 inz(.01) d B s 7 4 inz(1) d C s 15 5 inz(1) d D s 13 0 inz(1) d Result s 11 4 c eval Result = A*B*C*D In this case, Result = 0!!! Using the eval(r) statement will give the correct answer. Everyone using RPG IV really needs to understand the precision rules available on the eval statement and how they work. Scott Mildenberger > -----Original Message----- > From: William A.(Tony) Corbett [mailto:corbett@ASRESOURCES.COM] > Sent: Tuesday, June 11, 2002 5:30 PM > To: rpg400-l@midrange.com > Subject: Eval(R) - the R does NOT mean round... > > > The "Result Decimal Positions" precision rule works the same > as the default > rule except that if the statement involves an assignment to a numeric > variable or a conversion to a specific decimal precision, the > number of > decimal positions of any intermediate result is never reduced > below the > desired result decimal places.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.