4GL 4.11 decimal equality bug
Posted in 1995
I'm having an odd problem with 4GL (4.11) decimal types used in an equality test. A sample program does a calculation, displays two decimal(18,2) values (which appear equal) and then tests for equality (which fails). I wrote a C program to dump the dec_t structures, and this is what showed up. Variable A exp = 3 pos = 1 N=4 digits = (3 45 0 0) which equals 34500 Variable B exp =3 pos =1 N=2 digits = (3 45) which also equals 34500 For some reason, 4GL feels these two variables are not equal. IMHO opinion this is a *bug*, but I'm curious if it is fixed on later releases (please not 4.12, though). Here is my sample program: main define PriorAccDepr decimal(18,2) define MonthDepr float define MonthDiff smallint define FAAccAmt decimal(18,2) define diff decimal(20,10) let MonthDiff = 84 let FAAccAmt = 34500.0 let MonthDepr = (36000 - 1500) / 84 let PriorAccDepr = MonthDepr * MonthDIff { call dumpdec(faaccamt,prioraccdepr) (my c routine) } -- Now, both FAActAMmt s/b the same if FAAccAmt = PriorAccDepr then display "=" end if if FAAccAmt < PriorAccDepr then display "<" end if let diff = FAAccAmt - PriorAccDepr display "diff = ", diff using "###,###.##########" end main Any thoughts? **-------------------------+---------------------------** |James Bennett | Phone: 916.891.5281 | |Bi-Tech Software, Inc | Fax : 916.891.5011 | |1072 Marauder, Suite A | EMail: james@bi-tech.com | |Chico, CA 95973 | #include <disclaimer.h> | | | #include <smartquote.h> | **-------------------------+---------------------------**