|
Here is the code I tested and seems to work: if wIncrement <> *zero eval wAmt = wFee * %div(%int(Amt1): %int(wIncrement)) if %rem(%int(Amt1): %int(wIncrement)) <> 0 eval wAmt = wAmt + wFee endif endifJoe, %div & %rem require a whole number, with zero decimal places if I understand the manual correctly. Hence my use of the %int bif, as was pointed out originally by several brighter-than-me people.
The idea of using the delta, 1 in this instance, seems to me like it'd work but I haven't tested it.
Joe Pluta wrote:
Jon, this gives the wrong answer for the boundary condition of $500. In that case, you will get eight dollars rather than four. There is an absolute requirement in this case to use the non-zero "delta" figure, as in: Fee = 4 * (1 + %div( (650 - delta) : 500)) Personally, I'm not sure the %div will accept that notation, and I don't have the time to check it, but the delta is absolutely required. The algorithm I posted earlier using %int was correct, it just used the wrong base step (I simply left out the "1 +" portion of your code above). Thank you JoeFrom: Jon Paris fee = 4 * (1 + %Div(650: 500)) As others have pointed out the algorithm is also incorrect.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.