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



Ceiling() returns an integer so it's not appropriate for the $$ math the OP is doing.  It also does not *round* up in the traditional half-adjust fashion.

Ceiling(7.000001) would return 8.

Roger Harman
COMMON Certified Application Developer - ILE RPG on IBM i on Power

--


From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Justin Taylor <JUSTIN@xxxxxxxxxxxxx>

Sent: Wednesday, February 12, 2020 5:51 AM

To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>

Subject: RE: What is a good way to round up numbers in free form?

 


EVAL(H) will half-adjust but will not always round up.  When I need to always go up to the next value I use the CEILING SQL function (https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/db2/rbafzscaceiling.htm). 
For example:

EXEC SQL  set :result = ceiling(:input_value);





HTH







-----Original Message-----

From: dfreinkel [mailto:dfreinkel@xxxxxxxxxxxxxxxxx]


Sent: Tuesday, February 11, 2020 7:51 PM

To: RPG400-L <rpg400-l@xxxxxxxxxxxxxxxxxx>

Subject: What is a good way to round up numbers in free form?



I need to multiply qty (9,0) by money(8,3) giving a result with 2 decimal places.



 



I tried eval(r) but it is not rounding the values. Result is (9,2). So far my results are not rounding up.




 



I would not like to code a subroutine to round these values and so am asking if I missed a way to do that or what is a best practice to do this?



 



TIA



 



Darryl Freinkel



A4G.



Tel: 770.321.8562 Ext 111 | Cell: 678.355.8562



 






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.