[Java] ".computeFunction(GeneralFunction.STDEV)"
Posted: Sat May 09, 2009 4:04 am
Hello!
When I use ".computeFunction(GeneralFunction.STDEV)" to calculate the standard deviation of a dataset, something goes wrong:
If N={2;4;6}, the standard deviation would be "2" - but this method returns something like "6.92126369412475E-310".
The same sourcecode would work just fine with counting the number of elements in 'xCellRange' using the same Method but a different constant (e.g. "GeneralFunction.COUNTNUMS"):
and the result would be n=3, of course.
Here is my system:
OpenOffice 3.0.1
Ubuntu 9.04 Jaunty
Netbeans 6.5
Java SE 1.6.0_13
Does anyone have a clue, what's going on there?
Are there any alternatives in implementing this function with Java?
Sincerely
Christian
When I use ".computeFunction(GeneralFunction.STDEV)" to calculate the standard deviation of a dataset, something goes wrong:
Code: Select all
// Get an interface for calculations with 'xCellRange'
XSheetOperation xCellRangeOperate = (XSheetOperation) UnoRuntime.queryInterface(XSheetOperation.class, xCellRange);
// Calculate the standard deviation of elements in 'xCellRange'
xCellRangeStdev = xCellRangeOperate.computeFunction(GeneralFunction.STDEV);
// Use this for later calculations
return xCellRangeStdev;
The same sourcecode would work just fine with counting the number of elements in 'xCellRange' using the same Method but a different constant (e.g. "GeneralFunction.COUNTNUMS"):
Code: Select all
xCellRangeStdev = xCellRangeOperate.computeFunction(GeneralFunction.COUNTNUMS);Here is my system:
OpenOffice 3.0.1
Ubuntu 9.04 Jaunty
Netbeans 6.5
Java SE 1.6.0_13
Does anyone have a clue, what's going on there?
Are there any alternatives in implementing this function with Java?
Sincerely
Christian