[?] decimal rounding/truncating delimma
Posted in 1995
Topics: Stored Procedures & SPL, Platform-Specific Issues
Dear net.wisdom, I have run into an annoying little detail related to rounding/truncating. I would just as soon ignore it, but the accountants (and the people who sign my paychecks) feel otherwise about this. The following program and explaination pretty much sum up the situation. Please help. MAIN DEFINE subt,subt2 DECIMAL(12,2) LET subt = 1050.00 + 25.00 + 1050.00 * .0861 DISPLAY subt LET subt = 1050.00 + 25.00 - 1050.00 * .0861 DISPLAY subt END MAIN Running this program with Informix SE on AIX with an RS/6000 yeilds these results: subt = 1165.41 subt2 = 984.60 Can anyone explain this behavior to me. It appears that Informix rounds when adding and truncates when subtracting. In the back of my mind something tells me that this is the expected behavior, its just that this conflicts with what the front of my mind tells me. Much Thanks, -Todd Todd Bernhardt Programmer Willamette Industries, Inc. (503) 227-5581 x577 cpilot@teleport.com -- cpilot@teleport.COM Public Access User --- Not affiliated with Teleport Public Access UNIX and Internet at (503) 220-1016 (2400-14400, N81)