|
Birgitta Hauser wrote on 10/11/2006 11:16:54 AM:
there is also an easy way to use embedded SQL to directly round up/down
to
nearest 1000. By specifying a negative number in second parameter of the scalar function round, rounding to 10, 100 and so on can be done.
I think what the SQL engine does is implement the 'generic rounding algorithm, so if you don't like the idea of using SQL, you could use an RPG procedure. The rounding algorithm goes something like this: Let N be the number to round, S be the scale of the rounding (in this example S = 1000) 1) temp = N + S/2 2) result = (temp / S) * S I think this has to use 'integer division' to work. This is essentially what the H extender is about - hence the name - "(H)alf add". HTH, Adam ##################################################################################### Attention: The above message and/or attachment(s) is private and confidential and is intended only for the people for which it is addressed. If you are not named in the address fields, ignore the contents and delete all the material. Thank you. Have a nice day. For more information on email virus scanning, security and content management, please contact administrator@xxxxxxxxxxxx #####################################################################################
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.