Commit e96eae90 authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

добавлены функции

DEVSQ, EXPONDIST, FISHER, FISHERINV, FORECAST, FREQUENCY, GAMMALN, GEOMEAN, HARMEAN, HYPGEOMDIST, INTERCEPT, KURT, LARGE, MEDIAN, MODE, SMALL

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48808 954022d7-b5bf-4e40-9824-e11837661b57
parent 7aa66e63
......@@ -36,7 +36,7 @@
<script type="text/javascript" src="../graphics/DrawingContext.js"></script>
<script type="text/javascript" src="../graphics/pdfprinter.js"></script>
<!-- <script type="text/javascript" src="../offlinedocs/test-workbook9/Editor.js"></script> -->
<!--<script type="text/javascript" src="../offlinedocs/test-workbook9/Editor.js"></script>-->
<script type="text/javascript" src="../offlinedocs/test-workbook2.js"></script>
<script type="text/javascript" src="../model/CollaborativeEditing.js"></script>
......
This diff is collapsed.
......@@ -482,7 +482,7 @@ cFormulaFunction.Mathematic = {
if ( a.getValue() <= 0 || b.getValue() <= 0 )
this.array[r][c] = new cError( cErrorType.not_numeric );
this.array[r][c] = new cNumber( Math.fact( a.getValue() ) / (Math.fact( b.getValue() ) * Math.fact( a.getValue() - b.getValue() )) );
this.array[r][c] = new cNumber( Math.binomCoeff(a.getValue(),b.getValue()) );
}
else
this.array[r][c] = new cError( cErrorType.wrong_value_type );
......@@ -509,7 +509,7 @@ cFormulaFunction.Mathematic = {
if ( arg0.getValue() <= 0 || arg1.getValue() <= 0 || arg0.getValue() < arg1.getValue() )
return this.value = new cError( cErrorType.not_numeric );
return this.value = new cNumber( Math.fact( arg0.getValue() ) / (Math.fact( arg1.getValue() ) * Math.fact( arg0.getValue() - arg1.getValue() )) );
return this.value = new cNumber( Math.binomCoeff(arg0.getValue(),arg1.getValue()) );
}
r.getInfo = function () {
return {
......
......@@ -123,6 +123,13 @@ Math.fact = function ( n ) {
return res;
}
Math.ln = function( x ){
return Math.log( x ) / Math.log( Math.E );
}
Math.binomCoeff = function ( n, k ) {
return this.fact( n ) / (this.fact( k ) * this.fact( n - k ));
}
var _func = [];//для велосипеда а-ля перегрузка функций.
_func[cElementType.number] = [];
_func[cElementType.string] = [];
......@@ -1175,7 +1182,7 @@ function cBaseFunction( name ) {
cBaseFunction.prototype = {
constructor:cBaseFunction,
Calculate:function () {
return this.value = new cError( cErrorType.unsupported_function )
return this.value = new cError( cErrorType.wrong_name )
},
setArgumentsMin:function ( count ) {
this.argumentsMin = count;
......@@ -1836,12 +1843,39 @@ cArea.prototype.countCells = function () {
return new cNumber( count );
};
cArea.prototype.foreach = function ( action ) {
var _val = [], r = this.getRange();
if ( !r ) {
_val.push( new cError( cErrorType.bad_reference ) )
var r = this.getRange();
if ( r ) {
r._foreach2( action )
}
}
cArea.prototype.foreach2 = function ( action ) {
var r = this.getRange();
if ( r ) {
r._foreach2( function ( _cell ) {
var val;
switch ( _cell.getType() ) {
case CellValueType.Number:
_cell.getValueWithoutFormat() == "" ? val = new cEmpty() : val = new cNumber( _cell.getValueWithoutFormat() )
break;
case CellValueType.Bool:
val = new cBool( _cell.getValueWithoutFormat() );
break;
case CellValueType.Error:
val = new cError( _cell.getValueWithoutFormat() );
break;
case CellValueType.String:
val = new cString( _cell.getValueWithoutFormat() );
break;
default:
if ( _cell.getValueWithoutFormat() && _cell.getValueWithoutFormat() != "" ) {
val = new cNumber( _cell.getValueWithoutFormat() )
}
else
r._foreach2( action )
val = checkTypeCell( "" + _cell.getValueWithoutFormat() );
}
action(val);
} );
}
}
cArea.prototype.getMatrix = function () {
var arr = [],
......@@ -2227,6 +2261,39 @@ cArea3D.prototype.getMatrix = function () {
}
return arr;
}
cArea3D.prototype.foreach2 = function ( action ) {
var _wsA = this.wsRange();
if ( _wsA.length >= 1 ) {
var _r = this.range( _wsA );
for ( var i = 0; i < _r.length; i++ ) {
if ( _r[i] )
_r[i]._foreach2( function ( _cell ) {
var val;
switch ( _cell.getType() ) {
case CellValueType.Number:
_cell.getValueWithoutFormat() == "" ? val = new cEmpty() : val = new cNumber( _cell.getValueWithoutFormat() )
break;
case CellValueType.Bool:
val = new cBool( _cell.getValueWithoutFormat() );
break;
case CellValueType.Error:
val = new cError( _cell.getValueWithoutFormat() );
break;
case CellValueType.String:
val = new cString( _cell.getValueWithoutFormat() );
break;
default:
if ( _cell.getValueWithoutFormat() && _cell.getValueWithoutFormat() != "" ) {
val = new cNumber( _cell.getValueWithoutFormat() )
}
else
val = checkTypeCell( "" + _cell.getValueWithoutFormat() );
}
action(val);
} );
}
}
}
/** @constructor */
function cRef3D( val, _wsFrom, wb ) {/*Ref means Sheat1!A1 for example*/
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment