|
No joke. The math majors know this stuff cold, but here's the short form: when you're working with two numbers, you can always figure out the maximum value, and from that you can always figure out the (work/internal) field size to hold that value. If you're adding two numbers together, the largest field size you need is (# of digits in the largest field + 1). 999+999=1,998, right? You don't need a 5.0 variable unless you stick with odd length numerics. 999 * 999 = 998,001; add the # of digits in each field to get the maximum size. So the compiler /can/ figure out if a field's going to be too small. So we get a message in the compiler output, and 99.999% of us will ignore it anyway. Otherwise, let's consider the numeric data management options we already have: EXRPOPTS, EXTBINIT, FIXNBR, FLTDIV, INTPREC, and TRUNCNBR. We need one more option, to make it an odd number of options. -----Original Message----- From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]On Behalf Of Leland, David Sent: Thursday, December 06, 2001 1:16 PM To: 'rpg400-l@midrange.com' Subject: RE: Target for numeric operation too small...hello, Toronto? This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. -- [ Picked text/plain from multipart/alternative ] You're joking, right? -----Original Message----- From: Tyra_Brodsky@vfc.com [mailto:Tyra_Brodsky@vfc.com] Sent: Thursday, December 06, 2001 1:14 PM To: rpg400-l@midrange.com Subject: RE: Target for numeric operation too small...hello, Toronto? But wouldn't it be nice to know it at time of compile instead of time of execution???? That way I could fix the problem BEFORE it halts on me. Buck Calabro <Buck.Calabro@com To: rpg400-l@midrange.com msoft.net> cc: Sent by: Subject: RE: Target for numeric operation too small...hello, rpg400-l-admin@mi Toronto? drange.com 12/06/01 10:08 AM Please respond to rpg400-l >>I frankly would have liked to have seen >>a different option on the error >>message; "allow truncation." > >How about: EVAL(T) Hi Mark! I liken numeric truncation to an invalid array index. Rather than add an operand extender to allow the invalid index (or set it to 1) I would prefer to have a hard halt so that the operator is aware that we're about to lose some precision. After consulting with the programmer (me), it would be nice if the operator could take a "T" option, allow truncation and continue. If it's a first test, I might like to see the full scale results because the truncation may be only one of several issues I need to address. But I _prefer_ the hard error. --buck _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.