Skip to content

Commit

Permalink
Revert "Fix ROUNDDOWN function"
Browse files Browse the repository at this point in the history
This reverts commit 1ae954a.
  • Loading branch information
Bykiev committed Apr 23, 2024
1 parent 1ae954a commit b78e992
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
4 changes: 2 additions & 2 deletions main/SS/Formula/Functions/MathX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ public static double RoundDown(double n, int p)
{
if (p != 0)
{
decimal temp = Convert.ToDecimal(Math.Pow(10, p));
retval = Convert.ToDouble(Math.Floor(((decimal)n) * temp) / temp);
double temp = Math.Pow(10, p);
retval = Sign(n) * Math.Round((Math.Abs(n) * temp) - 0.5, MidpointRounding.AwayFromZero) / temp;
}
else
{
Expand Down
13 changes: 0 additions & 13 deletions testcases/ooxml/XSSF/UserModel/TestXSSFFormulaEvaluation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -755,19 +755,6 @@ public void EvaluateInCellReturnsSameDataType()
Assert.AreSame(cell, same);
wb.Close();
}

[Test]
public void TestRoundDown()
{
IWorkbook wb = XSSFTestDataSamples.OpenSampleWorkbook("Rounddown_Issue.xlsx");
var sheet = wb.GetSheetAt(0);
var formula = new XSSFFormulaEvaluator(wb);
formula.EvaluateAll();
var cellReference = new CellReference("Q13");
var row = sheet.GetRow(cellReference.Row);
var cell = row.GetCell(cellReference.Col);
Assert.AreEqual(17.56, cell.NumericCellValue, 0.00000001);
}
}

}
Binary file removed testcases/test-data/spreadsheet/Rounddown_Issue.xlsx
Binary file not shown.

0 comments on commit b78e992

Please sign in to comment.