|
Eval was designed so that overflow would be a hard error. I think the easiest way to handle it is to make sure the receiver value is large enough for any result of the calculation if there's no division involved, and if there's division by numbers between 0 and 1, check for the too small non-zero divisor. There are other things you can do that are more complicated involving conditon handlers and the PSSR. IMHO, the only difference between the old arithmetic opcodes and using eval with expressions is that the old opcodes masked overflow errors. Have you ever had an end user point out numbers that were too small that turned out to be the result of overflow and truncation? To me this is a design issue, and not a data issue. If you are getting numbers that are too large for their destination from a correct calculation that uses valid data, the error is in the size of the field that is assigned the result of the calculation. -----Original Message----- From: JamesRMoore@aol.com [mailto:JamesRMoore@aol.com] Sent: Friday, June 16, 2000 6:44 AM To: RPG400-L@midrange.com Subject: Eval Errors I am sure this has been covered before, but... I am do the maintenance for a bunch of programs that use Eval for calculations. Every once in awhile I get the error that the field is not big enough. What is the best way to use eval to avoid this? Thanks, Jim +--- | 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-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.