https://issues.apache.org/bugzilla/show_bug.cgi?id=54349
Bug ID: 54349
Summary: Rate formula inconsistency with long periods
Product: POI
Version: 3.8
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
in order to emulate excel's rate function, I'm using apache poi v3.8. My code
is:
public static void main(String[] args) {
int nper = 120;
double pmt = 28.1;
double pv = 2400;
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet();
FormulaEvaluator evaluator =
workbook.getCreationHelper().createFormulaEvaluator();
Row row = sheet.createRow(0);
Cell np = row.createCell(0);
np.setCellValue(nper);
Cell pt = row.createCell(1);
pt.setCellValue(pmt);
Cell cpv = row.createCell(2);
cpv.setCellValue(-pv);
Cell rate = row.createCell(3);
rate.setCellFormula("RATE(A1,B1,C1)");
evaluator.evaluateFormulaCell(rate);
double drate = rate.getNumericCellValue() * 100;
System.out.println("RATE: " + drate);
}
which output is the same as excel: 0.599
But if I try the same calculation, this time with the values:
int nper = 360;
double pmt = 15.9;
double pv = 2400;
In excel I get 0.580, and the program returns 3.722909655790338E-14. Is this a
known bug ? Any hints ? Thanks
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]