|
From: Bobby Hicks <Robert.Hicks@xxxxxxxxxxxxxxxx> To: MI Programming on the AS400 / iSeries <mi400@xxxxxxxxxxxx> > My main interest is in creating an expression entry screen like the one in > query where the user enters some expression. The result of this express > would be printed on a report. The problem is that I don't want overflow > errors if I divide a large number by a very small number. I know that the > current limit for numerical values would rarely be reached, but I'd like a > way around it just the same. More importantly, I want to know just > because I don't already how to do it. first of all, the small number (the divisor) could be zero so you always get overflow. Now, you can test for that. Any other number and the result of the division will always be smaller than the first number (the dividend). So if you can store and hold the dividend, you can always store and hold the result of the division. So, where is the problem? It is possible (and fun) to write routines that can add/subtract/multiply/divide numbers of arbitrary length, but you have to make a business case for it (maybe). Anyway, you just gave me an idea for yet another chapter (if I could only find the time). Leif
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.