mirror of https://github.com/apache/poi.git
add INT tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897715 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3a1fb48124
commit
9a97204dc8
|
@ -100,6 +100,7 @@ public abstract class NumericFunction implements Function {
|
|||
|
||||
public static final Function EXP = oneDouble(d -> Math.pow(Math.E, d));
|
||||
public static final Function FACT = oneDouble(MathX::factorial);
|
||||
//https://support.microsoft.com/en-us/office/int-function-a6c4af9e-356d-4369-ab6a-cb1fd9d343ef
|
||||
public static final Function INT = oneDouble(d -> Math.round(d-0.5));
|
||||
public static final Function LN = oneDouble(Math::log);
|
||||
public static final Function LOG10 = oneDouble(d -> Math.log(d) / LOG_10_TO_BASE_e);
|
||||
|
|
|
@ -30,8 +30,12 @@ final class TestNumericFunction {
|
|||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFCell cell = wb.createSheet().createRow(0).createCell(0);
|
||||
HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
|
||||
assertDouble(fe, cell, "880000000*0.00849", 7471200.0, 0.00000001);
|
||||
assertDouble(fe, cell, "880000000*0.00849/3", 2490400.0, 0.00000001);
|
||||
assertDouble(fe, cell, "INT(880000000*0.00849/3)", 2490400.0, 0.00000001);
|
||||
assertDouble(fe, cell, "INT(880000000.0001)", 880000000.0, 0);
|
||||
//the following INT(-880000000.0001) resulting in -880000001.0 has been observed in excel
|
||||
//see also https://support.microsoft.com/en-us/office/int-function-a6c4af9e-356d-4369-ab6a-cb1fd9d343ef
|
||||
assertDouble(fe, cell, "INT(-880000000.0001)", -880000001.0, 0);
|
||||
assertDouble(fe, cell, "880000000*0.00849", 7471200.0, 0);
|
||||
assertDouble(fe, cell, "880000000*0.00849/3", 2490400.0, 0);
|
||||
assertDouble(fe, cell, "INT(880000000*0.00849/3)", 2490400.0, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue