|
Hi Frank - >Date: 6 Oct 99 17:31:22 EST >From: Frank Kolmann <fkolmann@netscape.net> >Subject: Re: [Re: [Re: RPGILE V4.3 Gotcha]] > >"Ken Sims at SWS Nevada" <ken.sws@ke9nr.org> wrote: > >Not so Ken, design is OK, its the divide operation that caused the >intermediate result to have 20 dec places. >Obviously I needed to do an EVAL(R) but in the end I used the old RPG II >op codes. As I mentioned in my response to Jim, since the result of a divide operation has an indefinite number of digits to the right of the decimal point, the manual states very clearly that the total length of the intermediate result will always be 30. It also states, though not so clearly, that there will be as many digits to the left of the decimal point to prevent overflow (up to the max of 30, of course), with the rest being to the right of the decimal point to give you the MAXIMUM POSSIBLE PERCISION WITHOUT OVERFLOW. The people who wrote the compiler are not stupid. The size on the intermediate result of a divide may look really strange, but it is designed to give you the MAXIMUM POSSIBLE PERCISION WITHOUT OVERFLOW (unless it would take more than 30 digits to prevent overflow). Unless you have small numbers in big fields, a plain ol' EVAL (i.e. without (R)) works just dandy. If you do have small numbers in big fields, then you may need to use (R) or default it via the H-spec. But IMNSHO all of this criticism of the EVAL is unwarranted. I use lots of EVALs. I just put into production a whole new discounting process. I don't think I have an ADD, SUB, MULT, or DIV anyplace in the whole thing. I have yet to have a problem. I do use some [perhaps not so] common sense in the order of the operations within the EVAL, but that's really no different than needing to the do the same thing if you're using a series of discrete math operations. Ken Southern Wine & Spirits of Nevada, Inc. +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.