× 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.



Scott,

The problem with your first solution would be that integer expressions would be incorrectly rounded up to the next integer:
%dech(1.00 + 0.5: 7: 0) will become 2.

Joep Beckeringh


Scott Klement schreef:
Lance Gillespie wrote:
I thought: target = %dech(source * 1.01) : 7 : 0)
would do it, but no joy.

half adjusting (whether you use %dech or one of the myriad other ways to half-adjust in RPG) only rounds up when the number hits the halfway point to the next higher number. Thus 1.5 would round up to 2, but 1.49 would round down to 1. That's why it's called "half adjust".

You could, of course do this:

target = %dech((source*1.01) + 0.5: 7: 0);

Seems to me that would do what you want... if not, you can always do something like this:

if %int(target) <> target;
target = %int(target) + 1;
endif;



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.