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

fixed:

Bug 24779 - Неверная ошибка в результате вычисления функции STDEVP если отсутствуют значения
Bug 24777 - Отрицательный результат вычисления функции RECEIVED

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56655 954022d7-b5bf-4e40-9824-e11837661b57
parent 893ca3a0
......@@ -4865,12 +4865,19 @@ cRECEIVED.prototype.Calculate = function ( arg ) {
if ( discount instanceof cError ) return this.value = discount;
if ( basis instanceof cError ) return this.value = basis;
if ( settlement.getValue() >= maturity.getValue() || investment.getValue() <= 0 || discount.getValue() <= 0 || basis.getValue() < 0 || basis.getValue() > 4 )
settlement = settlement.getValue();
maturity = maturity.getValue();
investment = investment.getValue();
discount = discount.getValue();
basis = basis.getValue();
if ( settlement >= maturity || investment <= 0 || discount <= 0 || basis < 0 || basis > 4 ){
return this.value = new cError( cErrorType.not_numeric );
}
var res = investment.getValue() / ( 1 - ( discount.getValue() * yearFrac( Date.prototype.getDateFromExcel( settlement.getValue() ), Date.prototype.getDateFromExcel( maturity.getValue() ), basis.getValue() ) ) );
var res = investment / ( 1 - ( discount * yearFrac( Date.prototype.getDateFromExcel( settlement ), Date.prototype.getDateFromExcel( maturity ), basis ) ) );
this.value = new cNumber( res );
this.value = res >= 0 ? new cNumber( res ) : new cError( cErrorType.not_numeric );
// this.value.numFormat = 9;
return this.value;
......
......@@ -4678,7 +4678,7 @@ cSTDEVP.prototype.Calculate = function ( arg ) {
}
return new cNumber( Math.sqrt( sumSQRDeltaX / xLength ) );
return new cNumber( isNaN(_x) ? new cError( cErrorType.division_by_zero ) : Math.sqrt( sumSQRDeltaX / xLength ) );
}
......
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