|
Steve,
Excel stores numbers in floating point format. These numbers are
considered "approximate" (they are stored as binary mantessa & exponent,
which can not store all decimal values exactly.)
The normal way to deal with this is to do something like:
eval(H) Discount = SSCell_getNumericCellValue(cell);
the half-adjust (H) should solve the problem.
On 7/25/2014 1:21 PM, Steve Jones wrote:
I am reading an xls spreadsheet & the results I get back do not match whatThis is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
I see in the spreadsheet.
The spreadsheet shows a value of 85.35 but the RPG code returns 85.349
The
field Discount is defined at 10,3 If I change it to be 10,2 the resutl
is
85.34
The code I use is the following:
d Discount s 10 3 Inz(0)
row = SSSheet_getRow(sheet: 83);
cell = SSRow_GetCell(row: 7);
Type = SSCell_getCellType(cell);
If Type = CELL_TYPE_NUMERIC;
Discount = SSCell_getNumericCellValue(cell);
Endif;
In the spreadsheet if I increase the number of decimals to 3 it shows
85.350
Anyone have a clue on what is going on & how to fix it?
--
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
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.