Free Support Forum - aspose.com

Error with negative and decimal values in power formula

We are facing problems when calculating cubic roots using the formula power, using 1/3 as exponent in the the formula.We are reteriving a non numerique value.

We have updated the Aspose to 4.8 and the problem continues.

The problem is the same either if you use decimal or double type.

We get right values if we evaluate positive integers or if we get double positive values from a cell (using DoubleValue method).

Please contact soon.

Hi,

Which formula/function you are using? Do you use Power formula/function? Well, I have tested calculating the POWER formula with negative decimal values and it works fine with v4.8.2.0: http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry215207.aspx

Here is my sample code:

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Aspose.Cells.Cell datacell = worksheet.Cells[“A1”];
datacell.PutValue(2);
Aspose.Cells.Cell cell = worksheet.Cells[“A2”];
Aspose.Cells.Cell cell1 = worksheet.Cells[“A3”];
cell.Formula = “=POWER(” + datacell.IntValue + “,-1/3)”;
cell1.Formula = “=POWER(4,-2)”;

workbook.CalculateFormula();
//MessageBox.Show(cell.StringValue);
//MessageBox.Show(cell1.StringValue);

MessageBox.Show(cell.DoubleValue.ToString());
MessageBox.Show(cell1.DoubleValue.ToString());


If you still find the issue with the latest version, kindly post your template file (if you have) with sample code here to reproduce the issue. We will check your issue soon.

Thank you.