× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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
     endif

Joe, %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

Joe


From: 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 thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.