Strange, it's stored internally in Excel as a double and we're just using standard Java routines to convert to a double from bytes. The error is reasonably large too.
-- Glen ----- Original Message ----- From: "Andrew C. Oliver" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 18, 2002 11:30 PM Subject: Re: Wrong result from numberic cell value with v1.5.0-dev-20020416 > Anyone have any thoughts on this one? > > Teutscher, Uwe wrote: > > >But with poi version 1.0.1 I get the correct result. > >I think this is a step back. > > > >Uwe > > > >-----Original Message----- > >From: Andrew C. Oliver [mailto:[EMAIL PROTECTED]] > >Sent: Thursday, April 18, 2002 2:05 PM > >To: '[EMAIL PROTECTED]' > >Subject: Re: Wrong result from numberic cell value with > >v1.5.0-dev-20020416 > > > > > >Yes this is a documentation bug. We're using double. double rounding > >is not 100% accurate. Future versions may support BigDecimal as well, > >but not the current dev version. If you round to the expected decimal > >places you should get acceptable results. > > > >If someone wants to do a BigDecimal patch that provides it in addition > >to double, then I'll gladly commit it. > > > >-Andy > > > >On Thu, 2002-04-18 at 05:20, Teutscher, Uwe wrote: > > > >>Hi > >> > >>I have the following problem with POI versions > >>jakarta-poi-1.5.0-dev-20020416-bin and version 1.4583. > >> > >>I get the wrong result back when I read a cell with the vale 987.01. > >> > >> > >>public class Test { > >> public static void main(String[] args) throws IOException { > >> > >> POIFSFileSystem fs = new POIFSFileSystem(new > >>FileInputStream("test.xls")); > >> HSSFWorkbook wb = new HSSFWorkbook(fs); > >> HSSFSheet sheet = wb.getSheetAt(0); > >> HSSFRow row = sheet.getRow(0); > >> > >> HSSFCell cell = row.getCell((short)0); > >> System.out.println("> " + cell.getNumericCellValue()); > >> cell = row.getCell((short)1); > >> System.out.println("> " + cell.getNumericCellValue()); > >> cell = row.getCell((short)2); > >> System.out.println("> " + cell.getNumericCellValue()); > >> cell = row.getCell((short)3); > >> System.out.println("> " + cell.getNumericCellValue()); > >> } > >>} > >> > >>The excel file test.xls has one row with 4 cells: > >>987.0 987.01 987.02 987.011 > >> > >> > >>The result is: > >>987.0 > >>987.010625 > >>987.020625 > >>987.011 > >> > >>Thanks for your help > >> > <snip content="attachment that I can't decode anyhow"/> >
