×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




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 what
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?


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 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.