This is an automated email from the ASF dual-hosted git repository. jimjag pushed a commit to branch openformula in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 4065a7faa031e7b87cc7e4efca2d2340ab7eb88b Author: Jim Jagielski <[email protected]> AuthorDate: Wed Nov 18 09:14:06 2026 -0500 formula, sc, oox: repair the functions added after #523 Get back to baseline. The branch did not build. FDIST, FINV, ERRORTYPE, WEEKNUM and the ZGZ resource names keep their trunk behavior; the ODF variants are the new F.DIST, F.INV, ERROR.TYPE and one-argument ISOWEEKNUM. --- main/formula/inc/formula/FormulaCompiler.hxx | 3 + main/formula/inc/formula/compiler.hrc | 7 +- main/formula/inc/formula/opcode.hxx | 7 +- main/formula/source/core/api/FormulaCompiler.cxx | 25 +- .../formula/source/core/resource/core_resource.src | 36 +- main/oox/source/xls/formulabase.cxx | 17 +- main/sc/inc/helpids.h | 7 +- main/sc/source/core/inc/interpre.hxx | 11 +- main/sc/source/core/tool/interpr1.cxx | 157 +++++- main/sc/source/core/tool/interpr2.cxx | 155 ++---- main/sc/source/core/tool/interpr3.cxx | 541 +++++---------------- main/sc/source/core/tool/interpr4.cxx | 140 +----- main/sc/source/core/tool/parclass.cxx | 4 +- main/sc/source/filter/excel/xlformula.cxx | 27 +- main/sc/source/filter/qpro/qproform.cxx | 4 +- main/sc/source/ui/src/scfuncs.src | 108 ++-- main/sc/util/hidother.src | 7 +- 17 files changed, 452 insertions(+), 804 deletions(-) diff --git a/main/formula/inc/formula/FormulaCompiler.hxx b/main/formula/inc/formula/FormulaCompiler.hxx index 008669e791..c5fbcdb175 100644 --- a/main/formula/inc/formula/FormulaCompiler.hxx +++ b/main/formula/inc/formula/FormulaCompiler.hxx @@ -163,6 +163,9 @@ public: /// Put entry of symbol String and OpCode pair. void putOpCode( const String & rStr, const OpCode eOp ); + /// Put an additional symbol for eOp that is accepted on input only. + void putOpCodeAlias( const String & rStr, const OpCode eOp ); + /// Put entry of symbol String and AddIn international String pair. void putExternal( const String & rSymbol, const String & rAddIn ); diff --git a/main/formula/inc/formula/compiler.hrc b/main/formula/inc/formula/compiler.hrc index d09556ed9c..bfd14af4dd 100644 --- a/main/formula/inc/formula/compiler.hrc +++ b/main/formula/inc/formula/compiler.hrc @@ -410,10 +410,13 @@ #define SC_OPCODE_REPLACEB 414 #define SC_OPCODE_DATEDIF 415 #define SC_OPCODE_ISOWEEKNUM 416 +#define SC_OPCODE_F_DIST_LEFT 417 +#define SC_OPCODE_F_INV_LEFT 418 +#define SC_OPCODE_ERROR_TYPE_ODF 419 -#define SC_OPCODE_STOP_2_PAR 417 +#define SC_OPCODE_STOP_2_PAR 420 -#define SC_OPCODE_LAST_OPCODE_ID 416 /* last OpCode */ +#define SC_OPCODE_LAST_OPCODE_ID 419 /* last OpCode */ /*** Interna ***/ #define SC_OPCODE_INTERNAL_BEGIN 9999 diff --git a/main/formula/inc/formula/opcode.hxx b/main/formula/inc/formula/opcode.hxx index 802ef02b5e..93551a7d4f 100644 --- a/main/formula/inc/formula/opcode.hxx +++ b/main/formula/inc/formula/opcode.hxx @@ -174,6 +174,7 @@ enum OpCodeEnum ocGammaLn = SC_OPCODE_GAMMA_LN, ocGamma = SC_OPCODE_GAMMA, ocErrorType = SC_OPCODE_ERROR_TYPE, + ocErrorTypeODF = SC_OPCODE_ERROR_TYPE_ODF, ocErrCell = SC_OPCODE_ERR_CELL, ocFormula = SC_OPCODE_FORMULA, ocArabic = SC_OPCODE_ARABIC, @@ -241,7 +242,7 @@ enum OpCodeEnum ocRows = SC_OPCODE_ROWS, ocColumn = SC_OPCODE_COLUMN, ocRow = SC_OPCODE_ROW, - ocRRI = SC_OPCODE_RRI, + ocZGZ = SC_OPCODE_ZGZ, ocZW = SC_OPCODE_ZW, ocZZR = SC_OPCODE_ZZR, ocZins = SC_OPCODE_ZINS, @@ -368,8 +369,8 @@ enum OpCodeEnum ocGammaInv = SC_OPCODE_GAMMA_INV, ocTInv = SC_OPCODE_T_INV, ocFInv = SC_OPCODE_F_INV, - ocLegacyFDist = SC_OPCODE_LEGACY_F_DIST, - ocLegacyFInv = SC_OPCODE_LEGACY_F_INV, + ocFDistLeft = SC_OPCODE_F_DIST_LEFT, + ocFInvLeft = SC_OPCODE_F_INV_LEFT, ocChiTest = SC_OPCODE_CHI_TEST, ocLogInv = SC_OPCODE_LOG_INV, ocTableOp = SC_OPCODE_TABLE_OP, diff --git a/main/formula/source/core/api/FormulaCompiler.cxx b/main/formula/source/core/api/FormulaCompiler.cxx index 1b315967bf..17aa107267 100644 --- a/main/formula/source/core/api/FormulaCompiler.cxx +++ b/main/formula/source/core/api/FormulaCompiler.cxx @@ -112,7 +112,7 @@ short lcl_GetRetFormat( OpCode eOpCode ) case ocZins: case ocIRR: case ocMIRR: - case ocRRI: + case ocZGZ: case ocEffektiv: case ocNominal: case ocPercentSign: @@ -497,6 +497,12 @@ void FormulaCompiler::OpCodeMap::putOpCode( const String & rStr, const OpCode eO mpHashMap->insert( OpCodeHashMap::value_type( rStr, eOp)); } } +void FormulaCompiler::OpCodeMap::putOpCodeAlias( const String & rStr, const OpCode eOp ) +{ + DBG_ASSERT( 0 < eOp && sal_uInt16(eOp) < mnSymbols, "OpCodeMap::putOpCodeAlias: OpCode out of range"); + if (0 < eOp && sal_uInt16(eOp) < mnSymbols) + mpHashMap->insert( OpCodeHashMap::value_type( rStr, eOp)); +} // ----------------------------------------------------------------------------- // class FormulaCompiler // ----------------------------------------------------------------------------- @@ -620,8 +626,6 @@ void lcl_fillNativeSymbols(FormulaCompiler::NonConstOpCodeMapPtr& _xMap,bool _de OModuleClient aModuleClient; OpCodeList aOpCodeListNative( RID_STRLIST_FUNCTION_NAMES, s_SymbolMap ); // No AddInMap for native core mapping. - // Add ZGZ as alias for RRI (ocRRI) for backward compatibility - s_SymbolMap->putOpCode(String::CreateFromAscii("ZGZ"), ocRRI); } // if ( !s_SymbolMap.get() ) _xMap = s_SymbolMap; } @@ -660,9 +664,6 @@ void FormulaCompiler::InitSymbolsEnglish() const static NonConstOpCodeMapPtr s_sSymbol; if ( !s_sSymbol.get() ) loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH,FormulaGrammar::GRAM_ENGLISH,s_sSymbol); - // Add ZGZ as alias for RRI (ocRRI) for backward compatibility - if (s_sSymbol.get()) - s_sSymbol->putOpCode(String::CreateFromAscii("ZGZ"), ocRRI); mxSymbolsEnglish = s_sSymbol; } // ----------------------------------------------------------------------------- @@ -671,9 +672,6 @@ void FormulaCompiler::InitSymbolsPODF() const static NonConstOpCodeMapPtr s_sSymbol; if ( !s_sSymbol.get() ) loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH,FormulaGrammar::GRAM_PODF,s_sSymbol); - // Add ZGZ as alias for RRI (ocRRI) for backward compatibility - if (s_sSymbol.get()) - s_sSymbol->putOpCode(String::CreateFromAscii("ZGZ"), ocRRI); mxSymbolsPODF = s_sSymbol; } // ----------------------------------------------------------------------------- @@ -682,9 +680,6 @@ void FormulaCompiler::InitSymbolsODFF() const static NonConstOpCodeMapPtr s_sSymbol; if ( !s_sSymbol.get() ) loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF,FormulaGrammar::GRAM_ODFF,s_sSymbol); - // Add ZGZ as alias for RRI (ocRRI) for backward compatibility - if (s_sSymbol.get()) - s_sSymbol->putOpCode(String::CreateFromAscii("ZGZ"), ocRRI); mxSymbolsODFF = s_sSymbol; } // ----------------------------------------------------------------------------- @@ -696,6 +691,8 @@ void FormulaCompiler::loadSymbols(sal_uInt16 _nSymbols,FormulaGrammar::Grammar _ _xMap.reset( new OpCodeMap( SC_OPCODE_LAST_OPCODE_ID + 1, _eGrammar != FormulaGrammar::GRAM_ODFF, _eGrammar )); OModuleClient aModuleClient; OpCodeList aOpCodeList( _nSymbols, _xMap ); + // Files and API callers before RRI got its ODF name used ZGZ. + _xMap->putOpCodeAlias( String::CreateFromAscii("ZGZ"), ocZGZ); fillFromAddInMap( _xMap, _eGrammar); // Fill from collection for AddIns not already present. @@ -1080,6 +1077,10 @@ void FormulaCompiler::Factor() pFacToken = new FormulaFAPToken( pFacToken->GetOpCode(), nSepCount, pFacToken ); else pFacToken->SetByte( nSepCount ); + // ODF ISOWEEKNUM has one argument; AOO wrote WEEKNUM to ODF as + // ISOWEEKNUM with two, so only the two argument form stays ocWeek. + if ( nSepCount == 1 && pFacToken->GetOpCode() == ocWeek && mxSymbols->isODFF() ) + pFacToken->NewOpCode( ocIsoWeekNum, FormulaToken::PrivateAccess()); // EASTERSUNDAY() without a year depends on today's date if ( bNoParam && pFacToken->GetOpCode() == ocEasterSunday ) pArr->SetRecalcModeAlways(); diff --git a/main/formula/source/core/resource/core_resource.src b/main/formula/source/core/resource/core_resource.src index 6a2c10dcfc..27558b4a61 100644 --- a/main/formula/source/core/resource/core_resource.src +++ b/main/formula/source/core/resource/core_resource.src @@ -144,6 +144,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_S_NORM_INV { Text = "LEGACY.NORMSINV" ; }; String SC_OPCODE_GAMMA_LN { Text = "GAMMALN" ; }; String SC_OPCODE_ERROR_TYPE { Text = "ORG.OPENOFFICE.ERRORTYPE" ; }; + String SC_OPCODE_ERROR_TYPE_ODF { Text = "ERROR.TYPE" ; }; String SC_OPCODE_ERR_CELL { Text = "ZellError" ; }; // TODO: ancient legacy only, remove? String SC_OPCODE_FORMULA { Text = "FORMULA"; }; String SC_OPCODE_ARC_TAN_2 { Text = "ATAN2" ; }; @@ -212,7 +213,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_COLUMN { Text = "COLUMN" ; }; String SC_OPCODE_ROW { Text = "ROW" ; }; String SC_OPCODE_TABLE { Text = "SHEET" ; }; - String SC_OPCODE_RRI { Text = "RRI" ; }; + String SC_OPCODE_ZGZ { Text = "RRI" ; }; String SC_OPCODE_ZW { Text = "FV" ; }; String SC_OPCODE_ZZR { Text = "NPER" ; }; String SC_OPCODE_ZINS { Text = "RATE" ; }; @@ -283,8 +284,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_HYP_GEOM_DIST { Text = "HYPGEOMDIST" ; }; String SC_OPCODE_LOG_NORM_DIST { Text = "LOGNORMDIST" ; }; String SC_OPCODE_T_DIST { Text = "TDIST" ; }; - String SC_OPCODE_F_DIST { Text = "FDIST" ; }; - String SC_OPCODE_LEGACY_F_DIST { Text = "LEGACY.FDIST" ; }; + String SC_OPCODE_F_DIST { Text = "LEGACY.FDIST" ; }; + String SC_OPCODE_F_DIST_LEFT { Text = "FDIST" ; }; String SC_OPCODE_CHI_DIST { Text = "LEGACY.CHIDIST" ; }; String SC_OPCODE_WEIBULL { Text = "WEIBULL" ; }; String SC_OPCODE_NEG_BINOM_VERT { Text = "NEGBINOMDIST" ; }; @@ -328,8 +329,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_GAMMA_DIST { Text = "GAMMADIST" ; }; String SC_OPCODE_GAMMA_INV { Text = "GAMMAINV" ; }; String SC_OPCODE_T_INV { Text = "TINV" ; }; - String SC_OPCODE_F_INV { Text = "FINV" ; }; - String SC_OPCODE_LEGACY_F_INV { Text = "LEGACY.FINV" ; }; + String SC_OPCODE_F_INV { Text = "LEGACY.FINV" ; }; + String SC_OPCODE_F_INV_LEFT { Text = "FINV" ; }; String SC_OPCODE_CHI_TEST { Text = "LEGACY.CHITEST" ; }; String SC_OPCODE_LOG_INV { Text = "LOGINV" ; }; String SC_OPCODE_TABLE_OP { Text = "MULTIPLE.OPERATIONS" ; }; @@ -496,6 +497,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_S_NORM_INV { Text = "NORMSINV" ; }; String SC_OPCODE_GAMMA_LN { Text = "GAMMALN" ; }; String SC_OPCODE_ERROR_TYPE { Text = "ERRORTYPE" ; }; + String SC_OPCODE_ERROR_TYPE_ODF { Text = "ERROR.TYPE" ; }; String SC_OPCODE_ERR_CELL { Text = "ZellError" ; }; // TODO: ancient legacy only, remove? String SC_OPCODE_FORMULA { Text = "FORMULA"; }; String SC_OPCODE_ARC_TAN_2 { Text = "ATAN2" ; }; @@ -564,7 +566,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_COLUMN { Text = "COLUMN" ; }; String SC_OPCODE_ROW { Text = "ROW" ; }; String SC_OPCODE_TABLE { Text = "SHEET" ; }; - String SC_OPCODE_RRI { Text = "RRI" ; }; + String SC_OPCODE_ZGZ { Text = "RRI" ; }; String SC_OPCODE_ZW { Text = "FV" ; }; String SC_OPCODE_ZZR { Text = "NPER" ; }; String SC_OPCODE_ZINS { Text = "RATE" ; }; @@ -636,6 +638,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_LOG_NORM_DIST { Text = "LOGNORMDIST" ; }; String SC_OPCODE_T_DIST { Text = "TDIST" ; }; String SC_OPCODE_F_DIST { Text = "FDIST" ; }; + String SC_OPCODE_F_DIST_LEFT { Text = "F.DIST" ; }; String SC_OPCODE_CHI_DIST { Text = "CHIDIST" ; }; String SC_OPCODE_WEIBULL { Text = "WEIBULL" ; }; String SC_OPCODE_NEG_BINOM_VERT { Text = "NEGBINOMDIST" ; }; @@ -680,6 +683,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_GAMMA_INV { Text = "GAMMAINV" ; }; String SC_OPCODE_T_INV { Text = "TINV" ; }; String SC_OPCODE_F_INV { Text = "FINV" ; }; + String SC_OPCODE_F_INV_LEFT { Text = "F.INV" ; }; String SC_OPCODE_CHI_TEST { Text = "CHITEST" ; }; String SC_OPCODE_LOG_INV { Text = "LOGINV" ; }; String SC_OPCODE_TABLE_OP { Text = "TABLE" ; }; @@ -1120,6 +1124,10 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "ERRORTYPE" ; }; + String SC_OPCODE_ERROR_TYPE_ODF + { + Text [ en-US ] = "ERROR.TYPE" ; + }; String SC_OPCODE_ERR_CELL { Text = "ZellError" ; }; // TODO: ancient legacy only, remove? String SC_OPCODE_FORMULA { @@ -1393,7 +1401,7 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "SHEET" ; }; - String SC_OPCODE_RRI + String SC_OPCODE_ZGZ { Text [ en-US ] = "RRI" ; }; @@ -1602,7 +1610,7 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "LEFTB" ; }; - String SC_OPCODE_MIDB + String SC_OPCODE_MIDB { Text [ en-US ] = "MIDB" ; }; @@ -1627,8 +1635,8 @@ Resource RID_STRLIST_FUNCTION_NAMES Text [ en-US ] = "ISOWEEKNUM" ; }; String SC_OPCODE_TEXT - { - Text [ en-US ] = "TEXT" ; + { + Text [ en-US ] = "TEXT" ; }; String SC_OPCODE_SUBSTITUTE { @@ -1686,9 +1694,9 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "FDIST" ; }; - String SC_OPCODE_LEGACY_F_DIST + String SC_OPCODE_F_DIST_LEFT { - Text [ en-US ] = "LEGACY.FDIST" ; + Text [ en-US ] = "F.DIST" ; }; String SC_OPCODE_CHI_DIST { @@ -1870,9 +1878,9 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "FINV" ; }; - String SC_OPCODE_LEGACY_F_INV + String SC_OPCODE_F_INV_LEFT { - Text [ en-US ] = "LEGACY.FINV" ; + Text [ en-US ] = "F.INV" ; }; String SC_OPCODE_CHI_TEST { diff --git a/main/oox/source/xls/formulabase.cxx b/main/oox/source/xls/formulabase.cxx index 9c7e041598..314b879aa7 100644 --- a/main/oox/source/xls/formulabase.cxx +++ b/main/oox/source/xls/formulabase.cxx @@ -439,9 +439,9 @@ static const FunctionData saFuncTableBiff3[] = { "GROWTH", "GROWTH", 52, 52, 1, 4, A, { RA, RA, RA, VV }, 0 }, // BIFF2: 1-3, BIFF3: 1-4 { "TRUNC", "TRUNC", 197, 197, 1, 2, V, { VR }, 0 }, // BIFF2: 1, BIFF3: 1-2 { "DOLLAR", "USDOLLAR", 204, 204, 1, 2, V, { VR }, FUNCFLAG_IMPORTONLY }, - { 0/*"FIND"*/, "FINDB", 205, 205, 2, 3, V, { VR }, 0 }, - { 0/*"SEARCH"*/, "SEARCHB", 206, 206, 2, 3, V, { VR }, 0 }, - { 0/*"REPLACE"*/, "REPLACEB", 207, 207, 4, 4, V, { VR }, 0 }, + { "FINDB", "FINDB", 205, 205, 2, 3, V, { VR }, 0 }, + { "SEARCHB", "SEARCHB", 206, 206, 2, 3, V, { VR }, 0 }, + { "REPLACEB", "REPLACEB", 207, 207, 4, 4, V, { VR }, 0 }, { "LEFTB", "LEFTB", 208, 208, 1, 2, V, { VR }, 0 }, { "RIGHTB", "RIGHTB", 209, 209, 1, 2, V, { VR }, 0 }, { "MIDB", "MIDB", 210, 210, 3, 3, V, { VR }, 0 }, @@ -483,7 +483,7 @@ static const FunctionData saFuncTableBiff4[] = { "RANK", "RANK", 216, 216, 2, 3, V, { VR, RO, VR }, 0 }, { "DB", "DB", 247, 247, 4, 5, V, { VR }, 0 }, { "FREQUENCY", "FREQUENCY", 252, 252, 2, 2, A, { RA }, 0 }, - { "ORG.OPENOFFICE.ERRORTYPE","ERROR.TYPE", 261, 261, 1, 1, V, { VR }, 0 }, + { "ERROR.TYPE", "ERROR.TYPE", 261, 261, 1, 1, V, { VR }, 0 }, { "AVEDEV", "AVEDEV", 269, 269, 1, MX, V, { RX }, 0 }, { "BETADIST", "BETADIST", 270, 270, 3, 5, V, { VR }, 0 }, { "GAMMALN", "GAMMALN", 271, 271, 1, 1, V, { VR }, 0 }, @@ -668,7 +668,7 @@ static const FunctionData saFuncTableBiff5[] = { "COUNTIF", "COUNTIF", 346, 346, 2, 2, V, { RO, VR }, 0 }, { "COUNTBLANK", "COUNTBLANK", 347, 347, 1, 1, V, { RO }, 0 }, { "ISPMT", "ISPMT", 350, 350, 4, 4, V, { VR }, 0 }, - { 0, "DATEDIF", 351, 351, 3, 3, V, { VR }, FUNCFLAG_IMPORTONLY }, // not supported in Calc + { "DATEDIF", "DATEDIF", 351, 351, 3, 3, V, { VR }, FUNCFLAG_IMPORTONLY }, { 0, "DATESTRING", 352, 352, 1, 1, V, { VR }, FUNCFLAG_IMPORTONLY }, // not supported in Calc, missing in OOXML spec { 0, "NUMBERSTRING", 353, 353, 2, 2, V, { VR }, FUNCFLAG_IMPORTONLY }, // not supported in Calc, missing in OOXML spec { "ROMAN", "ROMAN", 354, 354, 1, 2, V, { VR }, 0 }, @@ -748,15 +748,13 @@ static const FunctionData saFuncTableOdf[] = { "COMBINA", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, { "DAYS", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, { "DECIMAL", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, - { "FDIST", 0, NOID, NOID, 3, 4, V, { VR }, FUNCFLAG_MACROCALLODF }, - { "FINV", 0, NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_MACROCALLODF }, { "FORMULA", 0, NOID, NOID, 1, 1, V, { RO }, FUNCFLAG_MACROCALLODF }, { "GAMMA", 0, NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALLODF }, { "GAUSS", 0, NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALLODF }, { "ISFORMULA", 0, NOID, NOID, 1, 1, V, { RO }, FUNCFLAG_MACROCALLODF }, { "ISOWEEKNUM", 0, NOID, NOID, 1, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, { "MUNIT", 0, NOID, NOID, 1, 1, A, { VR }, FUNCFLAG_MACROCALLODF }, - { "NUMBERVALUE", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "NUMBERVALUE", 0, NOID, NOID, 1, 3, V, { VR }, FUNCFLAG_MACROCALLODF }, { "PDURATION", 0, NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_MACROCALLODF }, { "PERMUTATIONA", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, { "PHI", 0, NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALLODF }, @@ -1154,7 +1152,8 @@ bool OpCodeProviderImpl::fillFuncTokenMaps( ApiTokenMap& orIntFuncTokenMap, ApiT const FormulaOpCodeMapEntry* pEntry = orEntrySeq.getConstArray(); const FormulaOpCodeMapEntry* pEntryEnd = pEntry + orEntrySeq.getLength(); for( ; pEntry != pEntryEnd; ++pEntry ) - ((pEntry->Token.OpCode == OPCODE_EXTERNAL) ? orExtFuncTokenMap : orIntFuncTokenMap)[ pEntry->Name ] = pEntry->Token; + // first entry wins, as in the formula compiler (ISOWEEKNUM names two opcodes) + ((pEntry->Token.OpCode == OPCODE_EXTERNAL) ? orExtFuncTokenMap : orIntFuncTokenMap).insert( ApiTokenMap::value_type( pEntry->Name, pEntry->Token ) ); } return orEntrySeq.hasElements(); } diff --git a/main/sc/inc/helpids.h b/main/sc/inc/helpids.h index a8f217188a..9c415b6a12 100644 --- a/main/sc/inc/helpids.h +++ b/main/sc/inc/helpids.h @@ -526,7 +526,6 @@ #define HID_FUNC_IKV "SC_HID_FUNC_IKV" #define HID_FUNC_LAUFZEIT "SC_HID_FUNC_LAUFZEIT" #define HID_FUNC_ZGZ "SC_HID_FUNC_ZGZ" -#define HID_FUNC_RRI "SC_HID_FUNC_RRI" #define HID_FUNC_QIKV "SC_HID_FUNC_QIKV" #define HID_FUNC_ISPMT "SC_HID_FUNC_ISPMT" @@ -687,10 +686,9 @@ #define HID_FUNC_TVERT "SC_HID_FUNC_TVERT" #define HID_FUNC_TINV "SC_HID_FUNC_TINV" #define HID_FUNC_FVERT "SC_HID_FUNC_FVERT" -#define HID_FUNC_FDIST "SC_HID_FUNC_FDIST" -#define HID_FUNC_LEGACY_FDIST "SC_HID_FUNC_LEGACY_FDIST" +#define HID_FUNC_F_DIST_LEFT "SC_HID_FUNC_F_DIST_LEFT" #define HID_FUNC_FINV "SC_HID_FUNC_FINV" -#define HID_FUNC_LEGACY_FINV "SC_HID_FUNC_LEGACY_FINV" +#define HID_FUNC_F_INV_LEFT "SC_HID_FUNC_F_INV_LEFT" #define HID_FUNC_CHIVERT "SC_HID_FUNC_CHIVERT" #define HID_FUNC_CHIINV "SC_HID_FUNC_CHIINV" #define HID_FUNC_STANDARDISIERUNG "SC_HID_FUNC_STANDARDISIERUNG" @@ -735,6 +733,7 @@ #define HID_FUNC_VERGLEICH "SC_HID_FUNC_VERGLEICH" #define HID_FUNC_VERSCHIEBUNG "SC_HID_FUNC_VERSCHIEBUNG" #define HID_FUNC_FEHLERTYP "SC_HID_FUNC_FEHLERTYP" +#define HID_FUNC_ERROR_TYPE_ODF "SC_HID_FUNC_ERROR_TYPE_ODF" #define HID_FUNC_VORLAGE "SC_HID_FUNC_VORLAGE" #define HID_FUNC_DDE "SC_HID_FUNC_DDE" #define HID_FUNC_TABELLE "SC_HID_FUNC_TABELLE" diff --git a/main/sc/source/core/inc/interpre.hxx b/main/sc/source/core/inc/interpre.hxx index 7659aad31c..1ce4151cf3 100644 --- a/main/sc/source/core/inc/interpre.hxx +++ b/main/sc/source/core/inc/interpre.hxx @@ -138,6 +138,7 @@ class ScInterpreter friend class ScBetaDistFunction; friend class ScTDistFunction; friend class ScFDistFunction; + friend class ScFDistLeftFunction; friend class ScChiDistFunction; friend class ScChiSqDistFunction; @@ -582,7 +583,7 @@ void ScMissing(); void ScMacro(); sal_Bool SetSbxVariable( SbxVariable* pVar, const ScAddress& ); sal_Bool SetSbxVariable( SbxVariable* pVar, SCCOL nCol, SCROW nRow, SCTAB nTab ); -void ScErrorType(); +void ScErrorType( bool bODF = false ); void ScDBArea(); void ScColRowNameAuto(); void ScExternalRef(); @@ -669,7 +670,7 @@ void ScLIA(); double ScGetRmz(double fZins, double fZzr, double fBw, double fZw, double fF); void ScRMZ(); -void ScRRI(); +void ScZGZ(); double ScGetZw(double fZins, double fZzr, double fRmz, double fBw, double fF); void ScZW(); @@ -749,7 +750,7 @@ double GetChiDist(double fChi, double fDF); // for LEGACY.CHIDIST, returns r double GetChiSqDistCDF(double fX, double fDF); // for CHISQDIST, returns left tail double GetChiSqDistPDF(double fX, double fDF); // probability density function double GetFDist(double x, double fF1, double fF2); -double GetFDistDens(double x, double fF1, double fF2); +double GetHypGeomDist( double x, double n, double M, double N ); double GetTDist(double T, double fDF); double Fakultaet(double x); double BinomKoeff(double n, double k); @@ -782,14 +783,14 @@ void ScLogNormDist(); void ScLogNormInv(); void ScTDist(); void ScFDist(); -void ScLegacyFDist(); +void ScFDistLeft(); void ScChiDist(); // for LEGACY.CHIDIST, returns right tail void ScChiSqDist(); // returns left tail or density void ScChiSqInv(); //invers to CHISQDIST void ScWeibull(); void ScBetaDist(); void ScFInv(); -void ScLegacyFInv(); +void ScFInvLeft(); void ScTInv(); void ScChiInv(); void ScBetaInv(); diff --git a/main/sc/source/core/tool/interpr1.cxx b/main/sc/source/core/tool/interpr1.cxx index 0f9ad8cd41..ceec43a5ec 100644 --- a/main/sc/source/core/tool/interpr1.cxx +++ b/main/sc/source/core/tool/interpr1.cxx @@ -3068,6 +3068,111 @@ void ScInterpreter::ScT() } +// Lexical form of xsd:float without INF and NaN. +static bool lcl_IsPlainFloat( const String& rStr ) +{ + xub_StrLen n = rStr.Len(), i = 0; + if ( i < n && (rStr.GetChar(i) == '+' || rStr.GetChar(i) == '-') ) + ++i; + xub_StrLen nDigits = 0; + while ( i < n && rStr.GetChar(i) >= '0' && rStr.GetChar(i) <= '9' ) + ++i, ++nDigits; + if ( i < n && rStr.GetChar(i) == '.' ) + { + ++i; + while ( i < n && rStr.GetChar(i) >= '0' && rStr.GetChar(i) <= '9' ) + ++i, ++nDigits; + } + if ( !nDigits ) + return false; + if ( i < n && (rStr.GetChar(i) == 'e' || rStr.GetChar(i) == 'E') ) + { + ++i; + if ( i < n && (rStr.GetChar(i) == '+' || rStr.GetChar(i) == '-') ) + ++i; + xub_StrLen nExp = 0; + while ( i < n && rStr.GetChar(i) >= '0' && rStr.GetChar(i) <= '9' ) + ++i, ++nExp; + if ( !nExp ) + return false; + } + return i == n; +} + +void ScInterpreter::ScNumberValue() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNumberValue" ); + sal_uInt8 nParamCount = GetByte(); + if ( !MustHaveParamCount( nParamCount, 1, 3 ) ) + return; + + String aGroupSep, aDecSep; + if ( nParamCount == 3 ) + aGroupSep = GetString(); + if ( nParamCount >= 2 ) + aDecSep = GetString(); + else + aDecSep = pFormatter->GetNumDecimalSep(); + if ( nParamCount < 3 ) + { + aGroupSep = pFormatter->GetNumThousandSep(); + // The locale's group separator must not cancel an explicit decimal separator. + if ( aDecSep.Len() == 1 && aGroupSep.Search( aDecSep.GetChar(0) ) != STRING_NOTFOUND ) + aGroupSep.Erase(); + } + String aText = GetString(); + if ( nGlobalError ) + { + PushError( nGlobalError ); + return; + } + if ( aDecSep.Len() != 1 || aGroupSep.Search( aDecSep.GetChar(0) ) != STRING_NOTFOUND ) + { + PushIllegalArgument(); + return; + } + + // ODF 1.2 6.13.28: group separators before the decimal separator go, the + // first decimal separator becomes '.', whitespace goes, then trailing '%'. + sal_Unicode cDecSep = aDecSep.GetChar(0); + String aNum; + bool bDecimal = false; + for ( xub_StrLen i = 0; i < aText.Len(); ++i ) + { + sal_Unicode c = aText.GetChar(i); + if ( !bDecimal && c == cDecSep ) + { + bDecimal = true; + aNum.Append( sal_Unicode('.') ); + } + else if ( !bDecimal && aGroupSep.Search( c ) != STRING_NOTFOUND ) + ; + else if ( c != ' ' && c != '\t' && c != '\n' && c != '\r' ) + aNum.Append( c ); + } + int nPercent = 0; + while ( aNum.Len() && aNum.GetChar( aNum.Len() - 1 ) == '%' ) + { + aNum.Erase( aNum.Len() - 1 ); + ++nPercent; + } + if ( !lcl_IsPlainFloat( aNum ) ) + { + PushIllegalArgument(); + return; + } + rtl_math_ConversionStatus eStatus; + double fVal = ::rtl::math::stringToDouble( aNum, '.', 0, &eStatus, NULL ); + if ( eStatus != rtl_math_ConversionStatus_Ok ) + { + PushIllegalArgument(); + return; + } + while ( nPercent-- > 0 ) + fVal /= 100.0; + PushDouble( fVal ); +} + void ScInterpreter::ScValue() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScValue" ); @@ -8168,8 +8273,8 @@ void ScInterpreter::ScFindB() return; } } - String aFindText = GetString(); String aWithinText = GetString(); + String aFindText = GetString(); sal_Int32 nByteLen = getLengthB(aWithinText); if ( fStart > static_cast<double>(nByteLen) ) @@ -8210,8 +8315,8 @@ void ScInterpreter::ScSearchB() return; } } - String aFindText = GetString(); String aWithinText = GetString(); + String aFindText = GetString(); sal_Int32 nByteLen = getLengthB(aWithinText); if ( fStart > static_cast<double>(nByteLen) ) @@ -8571,32 +8676,35 @@ void ScInterpreter::ScConcat() } -static sal_uInt16 MapErrorType( sal_uInt16 nInternalErr ) +// ODF ERROR.TYPE numbers, as the Excel export writes these errors. +static sal_uInt16 lcl_ErrorTypeODF( sal_uInt16 nErr ) { - switch ( nInternalErr ) + switch ( nErr ) { - case errNoCode: // 521 → #NULL! - return 1; - case errDivisionByZero: // 532 → #DIV/0! - return 2; - case errNoValue: // 519 → #VALUE! - return 3; - case errNoRef: // 524 → #REF! - return 4; - case errNoName: // 525 → #NAME? - return 5; - case errIllegalFPOperation: // 503 → #NUM! - return 6; - case NOTAVAILABLE: // 0x7fff → #N/A - return 7; - default: - return 0; // Unknown error type → will produce #N/A error + case errNoCode: return 1; // #NULL! + case errDivisionByZero: return 2; // #DIV/0! + case errNoValue: + case errIllegalArgument: + case errIllegalParameter: + case errPairExpected: + case errOperatorExpected: + case errVariableExpected: + case errParameterExpected: + case errCircularReference: return 3; // #VALUE! + case errNoRef: return 4; // #REF! + case errNoName: + case errNoAddin: + case errNoMacro: return 5; // #NAME? + case errIllegalFPOperation: return 6; // #NUM! } + return 7; // #N/A } -void ScInterpreter::ScErrorType() +void ScInterpreter::ScErrorType( bool bODF ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScErrorType" ); + if ( bODF && !MustHaveParamCount( GetByte(), 1 ) ) + return; sal_uInt16 nErr; sal_uInt16 nOldError = nGlobalError; nGlobalError = 0; @@ -8663,11 +8771,12 @@ void ScInterpreter::ScErrorType() PopError(); nErr = nGlobalError; } - sal_uInt16 nErrorType = MapErrorType( nErr ); - if ( nErrorType ) + if ( nErr && bODF ) + nErr = lcl_ErrorTypeODF( nErr ); + if ( nErr ) { nGlobalError = 0; - PushDouble( nErrorType ); + PushDouble( nErr ); } else { diff --git a/main/sc/source/core/tool/interpr2.cxx b/main/sc/source/core/tool/interpr2.cxx index 3f0e62f9f9..f0ec9d7035 100644 --- a/main/sc/source/core/tool/interpr2.cxx +++ b/main/sc/source/core/tool/interpr2.cxx @@ -463,141 +463,76 @@ void ScInterpreter::ScDateDif() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDateDif" ); if ( MustHaveParamCount( GetByte(), 3 ) ) { - // Arguments are popped in reverse order: Format, EndDate, StartDate - String aFormat = GetString(); - double nEndDate = GetDouble(); - double nStartDate = GetDouble(); - + String aFormat( GetString() ); + double fEnd = ::rtl::math::approxFloor( GetDouble() ); + double fStart = ::rtl::math::approxFloor( GetDouble() ); if ( nGlobalError ) { PushError( nGlobalError ); return; } - - // Floor to calendar dates (discard time fractions) - nStartDate = ::rtl::math::approxFloor( nStartDate ); - nEndDate = ::rtl::math::approxFloor( nEndDate ); - - const Date* pNullDate = pFormatter->GetNullDate(); - Date aStart = *pNullDate; - aStart += (long) nStartDate; - Date aEnd = *pNullDate; - aEnd += (long) nEndDate; - - if ( !aStart.IsValid() || !aEnd.IsValid() ) + if ( fStart > fEnd ) { PushIllegalArgument(); return; } - // Work forward for calculation; apply sign for reverse intervals at end. - bool bReverse = (aStart > aEnd); - Date aFrom = bReverse ? aEnd : aStart; - Date aTo = bReverse ? aStart : aEnd; - - sal_uInt32 nYear1 = aFrom.GetYear(); - sal_uInt32 nMonth1 = aFrom.GetMonth(); - sal_uInt32 nDay1 = aFrom.GetDay(); - sal_uInt32 nYear2 = aTo.GetYear(); - sal_uInt32 nMonth2 = aTo.GetMonth(); - sal_uInt32 nDay2 = aTo.GetDay(); - - // Complete calendar years (ODF 1.4 §6.10.3 "y") - long nYears = (long)nYear2 - (long)nYear1; - if ( nMonth2 < nMonth1 || (nMonth2 == nMonth1 && nDay2 < nDay1) ) - nYears--; - - // Complete calendar months (ODF 1.4 §6.10.3 "m") - long nMonths = ((long)nYear2 - (long)nYear1) * 12 - + ((long)nMonth2 - (long)nMonth1); - if ( nDay2 < nDay1 ) + Date aFrom = *(pFormatter->GetNullDate()); + aFrom += (long) fStart; + Date aTo = *(pFormatter->GetNullDate()); + aTo += (long) fEnd; + if ( !aFrom.IsValid() || !aTo.IsValid() ) { - // If start is the last day of its month, treat the end month as - // reached (end-of-month substitution); otherwise decrement. - if ( nDay1 != aFrom.GetDaysInMonth() ) - nMonths--; + PushIllegalArgument(); + return; } - double fResult = 0.0; - bool bValidFormat = true; + // Complete months: the end day must reach the start day. + long nMonths = ((long)aTo.GetYear() - (long)aFrom.GetYear()) * 12 + + ((long)aTo.GetMonth() - (long)aFrom.GetMonth()); + if ( aTo.GetDay() < aFrom.GetDay() ) + --nMonths; - if ( aFormat == "d" ) - { - // Calendar day difference (ODF 1.4 §6.10.3) + aFormat.ToLowerAscii(); + double fResult; + if ( aFormat.EqualsAscii( "d" ) ) fResult = (double)(aTo - aFrom); - } - else if ( aFormat == "m" ) - { + else if ( aFormat.EqualsAscii( "m" ) ) fResult = (double)nMonths; - } - else if ( aFormat == "y" ) - { - fResult = (double)nYears; - } - else if ( aFormat == "md" ) - { - // Days ignoring months and years (ODF 1.4 §6.10.3). - // If the end day is before the start day, borrow days from the - // start date's month (Excel-compatible / common ODF interpretation). - long nDays; - if ( nDay2 < nDay1 ) + else if ( aFormat.EqualsAscii( "y" ) ) + fResult = (double)(nMonths / 12); + else if ( aFormat.EqualsAscii( "ym" ) ) + fResult = (double)(nMonths % 12); + else if ( aFormat.EqualsAscii( "md" ) ) + { + // As Excel: borrow the length of the month before the end month, + // which gives a negative result for some month ends. + long nDays = (long)aTo.GetDay() - (long)aFrom.GetDay(); + if ( nDays < 0 ) { - sal_uInt16 nStartDays = aFrom.GetDaysInMonth(); - nDays = (long)nDay2 + (long)nStartDays - (long)nDay1; - } - else - { - nDays = (long)nDay2 - (long)nDay1; + Date aPrev( 1, aTo.GetMonth(), aTo.GetYear() ); + aPrev -= 1; + nDays += aPrev.GetDaysInMonth(); } fResult = (double)nDays; } - else if ( aFormat == "ym" ) - { - // Months ignoring years (ODF 1.4 §6.10.3): complete months - // remaining after subtracting complete years. - long nYM = nMonths - nYears * 12; - if ( nYM < 0 ) - nYM = 0; - fResult = (double)nYM; - } - else if ( aFormat == "yd" ) + else if ( aFormat.EqualsAscii( "yd" ) ) { - // Days ignoring years (ODF 1.4 §6.10.3): days between the start - // date shifted forward by the number of complete years and the end - // date, in the end date's year context. - sal_uInt16 nAnnYear = (sal_uInt16)((long)nYear2 - nYears); - Date aAnniversary( (sal_uInt16)nDay1, (sal_uInt16)nMonth1, nAnnYear ); - // Handle anniversary like Feb 29 in a non-leap anniversary year. - if ( !aAnniversary.IsValid() && nMonth1 == 2 && nDay1 == 29 ) - aAnniversary = Date( 28, 2, nAnnYear ); - fResult = (double)(aTo - aAnniversary); + // As Excel: move the end date into the first year that does not put it + // before the start date; February 29 becomes March 1 in other years. + sal_uInt16 nYear = aFrom.GetYear(); + if ( aTo.GetMonth() < aFrom.GetMonth() || + (aTo.GetMonth() == aFrom.GetMonth() && aTo.GetDay() < aFrom.GetDay()) ) + ++nYear; + Date aEnd( 1, aTo.GetMonth(), nYear ); + aEnd += (long)aTo.GetDay() - 1; + fResult = (double)(aEnd - aFrom); } else - { - bValidFormat = false; - } - - if ( !bValidFormat ) { PushIllegalArgument(); return; } - - // ODF 1.4 §6.10.3 does not define reverse intervals; apply - // Excel-compatible policy: negate y/m/d, keep md/ym/yd non-negative. - if ( bReverse ) - { - if ( aFormat == "md" || aFormat == "ym" || aFormat == "yd" ) - { - if ( fResult < 0.0 ) - fResult = -fResult; - } - else - { - fResult = -fResult; - } - } - PushDouble( fResult ); } } @@ -1357,9 +1292,9 @@ void ScInterpreter::ScRMZ() PushDouble(ScGetRmz(nZins, nZzr, nBw, nZw, nFlag)); } -void ScInterpreter::ScRRI() +void ScInterpreter::ScZGZ() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRRI" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZGZ" ); nFuncFmtType = NUMBERFORMAT_PERCENT; if ( MustHaveParamCount( GetByte(), 3 ) ) { diff --git a/main/sc/source/core/tool/interpr3.cxx b/main/sc/source/core/tool/interpr3.cxx index 7ef4a2b4ee..25c4b509da 100644 --- a/main/sc/source/core/tool/interpr3.cxx +++ b/main/sc/source/core/tool/interpr3.cxx @@ -669,22 +669,11 @@ double ScInterpreter::GetFDist(double x, double fF1, double fF2) double alpha = fF2/2.0; double beta = fF1/2.0; return (GetBetaDist(arg, alpha, beta)); -} - -double ScInterpreter::GetFDistDens(double x, double fF1, double fF2) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetFDistDens" ); - // F-distribution PDF: - // f(x; d1, d2) = (d1/d2)^(d1/2) * x^(d1/2 - 1) * (1 + (d1/d2)*x)^(-(d1+d2)/2) / B(d1/2, d2/2) - if (x <= 0.0) - return 0.0; - double d1 = fF1; - double d2 = fF2; - double log_pdf = (d1/2.0) * log(d1/d2) - + (d1/2.0 - 1.0) * log(x) - - ((d1 + d2)/2.0) * log(1.0 + (d1/d2)*x) - - log(GetBeta(d1/2.0, d2/2.0)); - return exp(log_pdf); +/* + double Z = (pow(fF,1.0/3.0)*(1.0-2.0/(9.0*fF2)) - (1.0-2.0/(9.0*fF1))) / + sqrt(2.0/(9.0*fF1) + pow(fF,2.0/3.0)*2.0/(9.0*fF2)); + return (0.5-gauss(Z)); +*/ } double ScInterpreter::GetTDist(double T, double fDF) @@ -1599,83 +1588,46 @@ void ScInterpreter::ScTDist() void ScInterpreter::ScFDist() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFDist" ); - if ( !MustHaveParamCount( GetByte(), 3, 4 ) ) + if ( !MustHaveParamCount( GetByte(), 3 ) ) return; double fF2 = ::rtl::math::approxFloor(GetDouble()); double fF1 = ::rtl::math::approxFloor(GetDouble()); double fF = GetDouble(); - double fCum = 1.0; // default to cumulative = TRUE (left-tail CDF for standard) - if (GetByte() == 4) - fCum = GetDouble(); if (fF < 0.0 || fF1 < 1.0 || fF2 < 1.0 || fF1 >= 1.0E10 || fF2 >= 1.0E10) { PushIllegalArgument(); return; } - if (fCum == 0.0) - { - // Probability density function (same as legacy) - PushDouble(GetFDistDens(fF, fF1, fF2)); - } - else - { - // Cumulative distribution function: LEFT-TAIL (standard) - // Left-tail = 1 - Right-tail - double fRightTail = GetFDist(fF, fF1, fF2); - PushDouble(1.0 - fRightTail); - } + PushDouble(GetFDist(fF, fF1, fF2)); } -} - -void ScInterpreter::ScLegacyFDist() +void ScInterpreter::ScFDistLeft() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLegacyFDist" ); - if ( !MustHaveParamCount( GetByte(), 3, 4 ) ) + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFDistLeft" ); + sal_uInt8 nParamCount = GetByte(); + if ( !MustHaveParamCount( nParamCount, 3, 4 ) ) return; + bool bCumulative = ( nParamCount == 4 ? GetBool() : true ); double fF2 = ::rtl::math::approxFloor(GetDouble()); double fF1 = ::rtl::math::approxFloor(GetDouble()); double fF = GetDouble(); - double fCum = 1.0; // default to cumulative = TRUE (right-tail CDF for legacy) - if (GetByte() == 4) - fCum = GetDouble(); - if (fF < 0.0 || fF1 < 1.0 || fF2 < 1.0 || fF1 >= 1.0E10 || fF2 >= 1.0E10) + if (fF1 < 1.0 || fF2 < 1.0 || fF1 >= 1.0E10 || fF2 >= 1.0E10) { PushIllegalArgument(); return; } - if (fCum == 0.0) - { - // Probability density function (same as standard) - PushDouble(GetFDistDens(fF, fF1, fF2)); - } - else + if (fF < 0.0) { - // Cumulative distribution function: RIGHT-TAIL (legacy) - PushDouble(GetFDist(fF, fF1, fF2)); - } -} - -void ScInterpreter::ScLegacyFInv() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLegacyFInv" ); - if ( !MustHaveParamCount( GetByte(), 3 ) ) - return; - double fF2 = ::rtl::math::approxFloor(GetDouble()); - double fF1 = ::rtl::math::approxFloor(GetDouble()); - double fP = GetDouble(); - if (fP <= 0.0 || fF1 < 1.0 || fF2 < 1.0 || fF1 >= 1.0E10 || fF2 >= 1.0E10 || fP > 1.0) - { - PushIllegalArgument(); + PushDouble(0.0); return; } - - bool bConvError; - ScFDistFunction aFunc( *this, fP, fF1, fF2 ); - double fVal = lcl_IterateInverse( aFunc, fF1*0.5, fF1, bConvError ); - if (bConvError) - SetError(errNoConvergence); - PushDouble(fVal); + // F(x;r1;r2) is Beta(r1/2;r2/2) at y = r1*x/(r1*x+r2). + double fDenom = fF1 * fF + fF2; + double fY = fF1 * fF / fDenom; + if (bCumulative) + PushDouble( GetBetaDist( fY, fF1 / 2.0, fF2 / 2.0)); + else + PushDouble( GetBetaDistPDF( fY, fF1 / 2.0, fF2 / 2.0) * fF1 * fF2 / (fDenom * fDenom)); } void ScInterpreter::ScChiDist() @@ -1781,389 +1733,103 @@ void ScInterpreter::ScPoissonDist() } } -} +/** Calculates a value of the hypergeometric distribution. -/** Calculates the PMF of the hypergeometric distribution for a given k. - Uses the same algorithm as ScHypGeomDist but for a specific k value. + C(M,x) * C(N-M,n-x) / C(N,n) is the product of the x factors of C(n,x), + which are at least 1, and of n ratios, which are at most 1. Taking a + ratio whenever the product has reached 1 and a factor otherwise keeps it + from overflowing on the way to a result of at most 1. */ -static double lcl_CalcHypGeomPMF( double N, double M, double n, double k ) +double ScInterpreter::GetHypGeomDist( double x, double n, double M, double N ) { - if( (k < 0.0) || (n < k) || (M < k) || (N < n) || (N < M) || (k < n - N + M) ) + if( (x < 0.0) || (n < x) || (M < x) || (N < n) || (N < M) || (x < n - N + M) ) + { + SetError(errIllegalArgument); return 0.0; - - const size_t nMaxArraySize = 500000; // arbitrary max array size - - typedef ::std::vector< double > HypContainer; - HypContainer cnNumer, cnDenom; - - double x = k; // use k as the x value - - size_t nEstContainerSize = static_cast<size_t>( x + ::std::min( n, M ) ); - size_t nMaxSize = ::std::min( static_cast<size_t>( cnNumer.max_size() ), static_cast<size_t>( 500000 ) ); - if ( nEstContainerSize > nMaxSize ) + } + if ( x + ::std::min( n, M ) > 500000.0 ) // arbitrary limit, as before + { + SetError(errNoValue); return 0.0; + } - HypContainer cnNumer, cnDenom; - cnNumer.reserve( static_cast<size_t>( nEstContainerSize + 10 ) ); - cnDenom.reserve( static_cast<size_t>( nEstContainerSize + 10 ) ); - - // Trim coefficient C first - double fCNumVarUpper = N - n - M + k - 1.0; - double fCDenomVarLower = 1.0; - if ( N - n - M + k >= M - k + 1.0 ) + // The same value with the fewest factors: the drawn and the remaining + // items swap roles, and so do the sample and the successes. + if ( n > N - n ) { - fCNumVarUpper = M - k - 1.0; - fCDenomVarLower = N - n - 2.0*(M - k) + 1.0; + x = M - x; + n = N - n; } + if ( n > M ) + ::std::swap( n, M ); -#ifdef DBG_UTIL - double fCNumLower = N - n - fCNumVarUpper; -#endif - double fCDenomUpper = N - n - M + k + 1.0 - fCDenomVarLower; - - double fDNumVarLower = n - M; - - if ( n >= M + 1.0 ) + double fRes = 1.0; + double fFactors = 0.0; + double fRatios = 0.0; + while ( fFactors < x || fRatios < n ) { - if ( N - M < n + 1.0 ) + if ( fFactors < x && (fRes < 1.0 || fRatios >= n) ) { - // Case 1 - - if ( N - n < n + 1.0 ) - { - // no overlap - lcl_PutFactorialElements( cnNumer, 0.0, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, N - n - 1.0, N ); - } - else - { - // overlap - // fCNumLower check removed for static function - lcl_PutFactorialElements( cnNumer, N - 2.0*n, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, n - 1.0, N ); - } - - // fCDenomUpper check - double fCDenomUpper = N - n - M + k + 1.0 - 1.0; // simplified - - if ( fCDenomUpper < n - k + 1.0 ) - // no overlap - lcl_PutFactorialElements( cnNumer, 1.0, N - M - n + k, N - M + 1.0 ); - else - { - // overlap - lcl_PutFactorialElements( cnNumer, 1.0, N - M - fCDenomUpper, N - M + 1.0 ); - } + fFactors += 1.0; + fRes *= (n - x + fFactors) / fFactors; } else { - // Case 2 - - if ( n > M - 1.0 ) - { - // no overlap - lcl_PutFactorialElements( cnNumer, 0.0, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, M - 1.0, N ); - } - else - { - lcl_PutFactorialElements( cnNumer, M - n, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, n - 1.0, N ); - } - - double fCDenomUpper = N - n - M + k + 1.0 - 1.0; - - if ( fCDenomUpper < n - k + 1.0 ) - // no overlap - lcl_PutFactorialElements( cnNumer, N - M - n + 1.0, N - M - n + k, N - M + 1.0 ); - else - { - lcl_PutFactorialElements( cnNumer, N - M - n + 1.0, N - M - fCDenomUpper, N - M + 1.0 ); - } - } - } - else - { - if ( N - M < M + 1.0 ) - { - // Case 3 - - if ( N - n < M + 1.0 ) - { - // No overlap - lcl_PutFactorialElements( cnNumer, 0.0, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, N - M - 1.0, N ); - } - else - { - lcl_PutFactorialElements( cnNumer, N - n - M, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, n - 1.0, N ); - } - - if ( n - x + 1.0 > fCDenomUpper ) - // No overlap - lcl_PutFactorialElements( cnNumer, 1.0, N - M - n + x, N - M + 1.0 ); + if ( fRatios < x ) + fRes *= (M - fRatios) / (N - fRatios); else - { - // Overlap - lcl_PutFactorialElements( cnNumer, 1.0, N - M - fCDenomUpper, N - M + 1.0 ); - } - } - else - { - // Case 4 - simplified for static function - // This is a simplified version; the full logic is complex - // For CDF computation, we only need valid k values + fRes *= (N - M - fRatios + x) / (N - fRatios); + fRatios += 1.0; } } - - // Build factorial elements for the k-specific case - // This is a simplified version that just computes the ratio - double fFactor = 1.0; - - // Use log-gamma for numerical stability - // PMF = C(M, k) * C(N-M, n-k) / C(N, n) - // Using log-gamma: log(PMF) = logGamma(M+1) - logGamma(k+1) - logGamma(M-k+1) - // + logGamma(N-M+1) - logGamma(n-k+1) - logGamma(N-M-n+k+1) - // - logGamma(N+1) + logGamma(n+1) + logGamma(N-n+1) - - double log_pmf = ::std::lgamma(M + 1.0) - ::std::lgamma(k + 1.0) - ::std::lgamma(M - k + 1.0) - + ::std::lgamma(N - M + 1.0) - ::std::lgamma(n - k + 1.0) - ::std::lgamma(N - M - n + k + 1.0) - - ::std::lgamma(N + 1.0) + ::std::lgamma(n + 1.0) + ::std::lgamma(N - n + 1.0); - - return ::std::exp(log_pmf); + return fRes; } + +void ScInterpreter::ScHypGeomDist() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScHypGeomDist" ); + sal_uInt8 nParamCount = GetByte(); + if ( !MustHaveParamCount( nParamCount, 4, 5 ) ) return; + bool bCumulative = ( nParamCount == 5 ? GetBool() : false ); double N = ::rtl::math::approxFloor(GetDouble()); double M = ::rtl::math::approxFloor(GetDouble()); double n = ::rtl::math::approxFloor(GetDouble()); double x = ::rtl::math::approxFloor(GetDouble()); - // Default Cumulative = FALSE (PMF) for 4-arg legacy compatibility - // 5-arg calls use explicit Cumulative flag - double bCumulative = 0.0; - if ( GetByte() == 5 ) - bCumulative = GetBool(); - - if( (x < 0.0) || (n < x) || (M < x) || (N < n) || (N < M) || (x < n - N + M) ) - { - PushIllegalArgument(); - return; - } - - typedef ::std::vector< double > HypContainer; - HypContainer cnNumer, cnDenom; - - size_t nEstContainerSize = static_cast<size_t>( x + ::std::min( n, M ) ); - size_t nMaxSize = ::std::min( cnNumer.max_size(), nMaxArraySize ); - if ( nEstContainerSize > nMaxSize ) + double fVal = GetHypGeomDist( x, n, M, N ); + if (bCumulative && !nGlobalError) { - PushNoValue(); - return; - } - cnNumer.reserve( nEstContainerSize + 10 ); - cnDenom.reserve( nEstContainerSize + 10 ); - - // Trim coefficient C first - double fCNumVarUpper = N - n - M + x - 1.0; - double fCDenomVarLower = 1.0; - if ( N - n - M + x >= M - x + 1.0 ) - { - fCNumVarUpper = M - x - 1.0; - fCDenomVarLower = N - n - 2.0*(M - x) + 1.0; - } - -#ifdef DBG_UTIL - double fCNumLower = N - n - fCNumVarUpper; -#endif - double fCDenomUpper = N - n - M + x + 1.0 - fCDenomVarLower; - - double fDNumVarLower = n - M; - - if ( n >= M + 1.0 ) - { - if ( N - M < n + 1.0 ) + // Sum the smaller tail with the term ratios, walking away from the + // mode so the terms only shrink and the summed value stays accurate. + double fMode = ::rtl::math::approxFloor( (n + 1.0) * (M + 1.0) / (N + 2.0)); + double fSum = 0.0; + double fTerm = fVal; + if (x < fMode) { - // Case 1 - - if ( N - n < n + 1.0 ) + double fLow = ::std::max( 0.0, n - N + M); + for (double k = x; k > fLow; --k) { - // no overlap - lcl_PutFactorialElements( cnNumer, 0.0, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, N - n - 1.0, N ); - } - else - { - // overlap - DBG_ASSERT( fCNumLower < n + 1.0, "ScHypGeomDist: wrong assertion" ); - lcl_PutFactorialElements( cnNumer, N - 2.0*n, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, n - 1.0, N ); - } - - DBG_ASSERT( fCDenomUpper <= N - M, "ScHypGeomDist: wrong assertion" ); - - if ( fCDenomUpper < n - x + 1.0 ) - // no overlap - lcl_PutFactorialElements( cnNumer, 1.0, N - M - n + x, N - M + 1.0 ); - else - { - // overlap - lcl_PutFactorialElements( cnNumer, 1.0, N - M - fCDenomUpper, N - M + 1.0 ); - - fCDenomUpper = n - x; - fCDenomVarLower = N - M - 2.0*(n - x) + 1.0; + fSum += fTerm; + fTerm *= k * (N - M - n + k) / ((M - k + 1.0) * (n - k + 1.0)); } + fVal = fSum + fTerm; } else { - // Case 2 - - if ( n > M - 1.0 ) - { - // no overlap - lcl_PutFactorialElements( cnNumer, 0.0, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, M - 1.0, N ); - } - else + double fHigh = ::std::min( n, M); + for (double k = x; k < fHigh; ++k) { - lcl_PutFactorialElements( cnNumer, M - n, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, n - 1.0, N ); - } - - DBG_ASSERT( fCDenomUpper <= n, "ScHypGeomDist: wrong assertion" ); - - if ( fCDenomUpper < n - x + 1.0 ) - // no overlap - lcl_PutFactorialElements( cnNumer, N - M - n + 1.0, N - M - n + x, N - M + 1.0 ); - else - { - lcl_PutFactorialElements( cnNumer, N - M - n + 1.0, N - M - fCDenomUpper, N - M + 1.0 ); - fCDenomUpper = n - x; - fCDenomVarLower = N - M - 2.0*(n - x) + 1.0; + fTerm *= (M - k) * (n - k) / ((k + 1.0) * (N - M - n + k + 1.0)); + fSum += fTerm; } + fVal = 1.0 - fSum; } - - DBG_ASSERT( fCDenomUpper <= M, "ScHypGeomDist: wrong assertion" ); - } - else - { - if ( N - M < M + 1.0 ) - { - // Case 3 - - if ( N - n < M + 1.0 ) - { - // No overlap - lcl_PutFactorialElements( cnNumer, 0.0, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, N - M - 1.0, N ); - } - else - { - lcl_PutFactorialElements( cnNumer, N - n - M, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, n - 1.0, N ); - } - - if ( n - x + 1.0 > fCDenomUpper ) - // No overlap - lcl_PutFactorialElements( cnNumer, 1.0, N - M - n + x, N - M + 1.0 ); - else - { - // Overlap - lcl_PutFactorialElements( cnNumer, 1.0, N - M - fCDenomUpper, N - M + 1.0 ); - - fCDenomVarLower = N - M - 2.0*(n - x) + 1.0; - fCDenomUpper = n - x; - } - } - else - { - // Case 4 - - DBG_ASSERT( M >= n - x, "ScHypGeomDist: wrong assertion" ); - DBG_ASSERT( M - x <= N - M + 1.0, "ScHypGeomDist: wrong assertion" ); - - if ( N - n < N - M + 1.0 ) - { - // No overlap - lcl_PutFactorialElements( cnNumer, 0.0, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, M - 1.0, N ); - } - else - { - // Overlap - DBG_ASSERT( fCNumLower <= N - M + 1.0, "ScHypGeomDist: wrong assertion" ); - - lcl_PutFactorialElements( cnNumer, M - n, fCNumVarUpper, N - n ); - lcl_PutFactorialElements( cnDenom, 0.0, n - 1.0, N ); - } - - if ( n - x + 1.0 > fCDenomUpper ) - // No overlap - lcl_PutFactorialElements( cnNumer, N - 2.0*M + 1.0, N - M - n + x, N - M + 1.0 ); - else if ( M >= fCDenomUpper ) - { - lcl_PutFactorialElements( cnNumer, N - 2.0*M + 1.0, N - M - fCDenomUpper, N - M + 1.0 ); - - fCDenomUpper = n - x; - fCDenomVarLower = N - M - 2.0*(n - x) + 1.0; - } - else - { - DBG_ASSERT( M <= fCDenomUpper, "ScHypGeomDist: wrong assertion" ); - lcl_PutFactorialElements( cnDenom, fCDenomVarLower, N - n - 2.0*M + x, - N - n - M + x + 1.0 ); - - fCDenomUpper = n - x; - fCDenomVarLower = N - M - 2.0*(n - x) + 1.0; - } - } - - DBG_ASSERT( fCDenomUpper <= n, "ScHypGeomDist: wrong assertion" ); - - fDNumVarLower = 0.0; - } - - double nDNumVarUpper = fCDenomUpper < x + 1.0 ? n - x - 1.0 : n - fCDenomUpper - 1.0; - double nDDenomVarLower = fCDenomUpper < x + 1.0 ? fCDenomVarLower : N - n - M + x + 1.0; - lcl_PutFactorialElements( cnNumer, fDNumVarLower, nDNumVarUpper, n ); - lcl_PutFactorialElements( cnDenom, nDDenomVarLower, N - n - M + x, N - n - M + x + 1.0 ); - - ::std::sort( cnNumer.begin(), cnNumer.end() ); - ::std::sort( cnDenom.begin(), cnDenom.end() ); - HypContainer::reverse_iterator it1 = cnNumer.rbegin(), it1End = cnNumer.rend(); - HypContainer::reverse_iterator it2 = cnDenom.rbegin(), it2End = cnDenom.rend(); - - double fFactor = 1.0; - for ( ; it1 != it1End || it2 != it2End; ) - { - double fEnum = 1.0, fDenom = 1.0; - if ( it1 != it1End ) - fEnum = *it1++; - if ( it2 != it2End ) - fDenom = *it2++; - fFactor *= fEnum / fDenom; - } - - double fPMF = fFactor; - - if ( bCumulative ) - { - // Compute CDF: sum of PMF from 0 to x - double fCDF = 0.0; - for ( double k = 0.0; k <= x; k++ ) - { - // Use the same PMF computation logic - double fPMF_k = lcl_CalcHypGeomPMF( N, M, n, k ); - fCDF += fPMF_k; - } - PushDouble( fCDF ); - } - else - { - PushDouble( fPMF ); } + PushDouble( fVal); } + void ScInterpreter::ScGammaDist() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGammaDist" ); @@ -2359,30 +2025,28 @@ void ScInterpreter::ScTInv() PushDouble(fVal); } -class ScFDistFunction : public ScDistFunc +class ScFDistLeftFunction : public ScDistFunc { ScInterpreter& rInt; double fp, fF1, fF2; public: - ScFDistFunction( ScInterpreter& rI, double fpVal, double fF1Val, double fF2Val ) : + ScFDistLeftFunction( ScInterpreter& rI, double fpVal, double fF1Val, double fF2Val ) : rInt(rI), fp(fpVal), fF1(fF1Val), fF2(fF2Val) {} - double GetValue( double x ) const { return fp - rInt.GetFDist(x, fF1, fF2); } + double GetValue( double x ) const { return fp - rInt.GetBetaDist( fF1 * x / (fF1 * x + fF2), fF1 / 2.0, fF2 / 2.0); } }; -class ScStandardFDistFunction : public ScDistFunc +class ScFDistFunction : public ScDistFunc { ScInterpreter& rInt; double fp, fF1, fF2; public: - ScStandardFDistFunction( ScInterpreter& rI, double fpVal, double fF1Val, double fF2Val ) : + ScFDistFunction( ScInterpreter& rI, double fpVal, double fF1Val, double fF2Val ) : rInt(rI), fp(fpVal), fF1(fF1Val), fF2(fF2Val) {} - // Left-tail CDF: 1 - right-tail CDF - // We want: left-tail = fp => 1 - right-tail = fp => right-tail = 1 - fp - double GetValue( double x ) const { return (1.0 - fp) - rInt.GetFDist(x, fF1, fF2); } + double GetValue( double x ) const { return fp - rInt.GetFDist(x, fF1, fF2); } }; void ScInterpreter::ScFInv() @@ -2400,7 +2064,34 @@ void ScInterpreter::ScFInv() } bool bConvError; - ScStandardFDistFunction aFunc( *this, fP, fF1, fF2 ); + ScFDistFunction aFunc( *this, fP, fF1, fF2 ); + double fVal = lcl_IterateInverse( aFunc, fF1*0.5, fF1, bConvError ); + if (bConvError) + SetError(errNoConvergence); + PushDouble(fVal); +} + +void ScInterpreter::ScFInvLeft() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFInvLeft" ); + if ( !MustHaveParamCount( GetByte(), 3 ) ) + return; + double fF2 = ::rtl::math::approxFloor(GetDouble()); + double fF1 = ::rtl::math::approxFloor(GetDouble()); + double fP = GetDouble(); + if (fP < 0.0 || fP >= 1.0 || fF1 < 1.0 || fF2 < 1.0 || fF1 >= 1.0E10 || fF2 >= 1.0E10) + { + PushIllegalArgument(); + return; + } + if (fP == 0.0) + { + PushDouble(0.0); + return; + } + + bool bConvError; + ScFDistLeftFunction aFunc( *this, fP, fF1, fF2 ); double fVal = lcl_IterateInverse( aFunc, fF1*0.5, fF1, bConvError ); if (bConvError) SetError(errNoConvergence); diff --git a/main/sc/source/core/tool/interpr4.cxx b/main/sc/source/core/tool/interpr4.cxx index 8d9c1074a7..8e7f21fbe0 100644 --- a/main/sc/source/core/tool/interpr4.cxx +++ b/main/sc/source/core/tool/interpr4.cxx @@ -61,8 +61,6 @@ #include "externalrefmgr.hxx" #include "doubleref.hxx" #include "token.hxx" -#include "stringutil.hxx" -#include <rtl/ustrbuf.hxx> #include <math.h> #include <float.h> @@ -3515,7 +3513,7 @@ StackVar ScInterpreter::Interpret() case ocGetDay : ScGetDay(); break; case ocGetDayOfWeek : ScGetDayOfWeek(); break; case ocWeek : ScGetWeekOfYear(); break; - case ocIsoWeekNum : ScIsoWeekNum(); break; + case ocIsoWeekNum : ScIsoWeekNum(); break; case ocEasterSunday : ScEasterSunday(); break; case ocGetHour : ScGetHour(); break; case ocGetMin : ScGetMin(); break; @@ -3616,7 +3614,7 @@ StackVar ScInterpreter::Interpret() case ocColumn : ScColumn(); break; case ocRow : ScRow(); break; case ocTable : ScTable(); break; - case ocRRI : ScRRI(); break; + case ocZGZ : ScZGZ(); break; case ocZW : ScZW(); break; case ocZZR : ScZZR(); break; case ocZins : ScZins(); break; @@ -3690,7 +3688,7 @@ StackVar ScInterpreter::Interpret() case ocLogNormDist : ScLogNormDist(); break; case ocTDist : ScTDist(); break; case ocFDist : ScFDist(); break; - case ocLegacyFDist : ScLegacyFDist(); break; + case ocFDistLeft : ScFDistLeft(); break; case ocChiDist : ScChiDist(); break; case ocChiSqDist : ScChiSqDist(); break; case ocStandard : ScStandard(); break; @@ -3744,7 +3742,7 @@ StackVar ScInterpreter::Interpret() case ocChiSqInv : ScChiSqInv(); break; case ocTInv : ScTInv(); break; case ocFInv : ScFInv(); break; - case ocLegacyFInv : ScLegacyFInv(); break; + case ocFInvLeft : ScFInvLeft(); break; case ocLogInv : ScLogNormInv(); break; case ocBetaDist : ScBetaDist(); break; case ocBetaInv : ScBetaInv(); break; @@ -3753,6 +3751,7 @@ StackVar ScInterpreter::Interpret() // case ocErrCell : ScErrCell(); break; case ocStop : break; case ocErrorType : ScErrorType(); break; + case ocErrorTypeODF : ScErrorType( true ); break; case ocCurrent : ScCurrent(); break; case ocStyle : ScStyle(); break; case ocDde : ScDde(); break; @@ -3862,6 +3861,7 @@ StackVar ScInterpreter::Interpret() case ocCount : \ case ocCount2 : \ case ocErrorType : \ + case ocErrorTypeODF : \ case ocIsEmpty : \ case ocIsErr : \ case ocIsError : \ @@ -4070,131 +4070,3 @@ StackVar ScInterpreter::Interpret() static_cast<ScToken*>(xResult.operator->())->GetMatrix()->SetImmutable( true); return eType; } - -void ScInterpreter::ScNumberValue() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNumberValue" ); - sal_uInt8 nParamCount = GetByte(); - if ( MustHaveParamCount( nParamCount, 1, 3 ) ) - { - // Parameters are popped in reverse order: group_sep, decimal_sep, text - sal_Unicode dsep = 0; - sal_Unicode gsep = 0; - - if (nParamCount >= 3) - { - String aGroupSep = GetString(); - if (aGroupSep.Len() > 0) - gsep = aGroupSep.GetChar(0); - } - if (nParamCount >= 2) - { - String aDecSep = GetString(); - if (aDecSep.Len() > 0) - dsep = aDecSep.GetChar(0); - } - - String aText = GetString(); - - // Use locale defaults for omitted or empty separators - if (dsep == 0) - { - const String& rDefDecSep = pFormatter->GetNumDecimalSep(); - if (rDefDecSep.Len() > 0) - dsep = rDefDecSep.GetChar(0); - } - if (gsep == 0) - { - const String& rDefThousandSep = pFormatter->GetNumThousandSep(); - if (rDefThousandSep.Len() > 0) - gsep = rDefThousandSep.GetChar(0); - } - - // ODF 1.4 §6.13.28 transformation steps: - // 1. Remove all whitespace characters - // 2. Count and strip trailing percent signs (each divides by 100) - // 3. Remove all group separator characters (lenient, no 3-digit check) - // 4. Replace decimal separator with ASCII period for parsing - // 5. Parse as number, verify entire string consumed - // 6. Divide by 100 for each percent sign - - ::rtl::OUString aOUText(aText); - sal_Int32 nLen = aOUText.getLength(); - - // Step 1: Remove all whitespace - ::rtl::OUStringBuffer aBuf; - aBuf.reserve(nLen); - const sal_Unicode* p = aOUText.getStr(); - for (sal_Int32 i = 0; i < nLen; ++i) - { - sal_Unicode c = p[i]; - if (c != sal_Unicode(' ') && c != sal_Unicode('\t') && - c != sal_Unicode('\n') && c != sal_Unicode('\r')) - aBuf.append(c); - } - aOUText = aBuf.makeStringAndClear(); - nLen = aOUText.getLength(); - - if (nLen == 0) - { - PushIllegalArgument(); - return; - } - - // Step 2: Count trailing percent signs - sal_Int32 nPercentCount = 0; - const sal_Unicode* pStr = aOUText.getStr(); - while (nLen > 0 && pStr[nLen - 1] == sal_Unicode('%')) - { - ++nPercentCount; - --nLen; - } - - // Step 3: Remove group separators (skip if same as decimal separator) - ::rtl::OUStringBuffer aBuf2; - aBuf2.reserve(nLen); - p = aOUText.getStr(); - for (sal_Int32 i = 0; i < nLen; ++i) - { - sal_Unicode c = p[i]; - if (gsep != 0 && c == gsep && (dsep == 0 || c != dsep)) - continue; - aBuf2.append(c); - } - aOUText = aBuf2.makeStringAndClear(); - nLen = aOUText.getLength(); - - // Step 4: Replace decimal separator with ASCII period - ::rtl::OUStringBuffer aBuf3; - aBuf3.reserve(nLen); - p = aOUText.getStr(); - for (sal_Int32 i = 0; i < nLen; ++i) - { - sal_Unicode c = p[i]; - if (dsep != 0 && c == dsep) - aBuf3.append(sal_Unicode('.')); - else - aBuf3.append(c); - } - ::rtl::OUString aParsable = aBuf3.makeStringAndClear(); - - // Step 5: Parse as number, verify entire string consumed - rtl_math_ConversionStatus eStatus; - sal_Int32 nParseEnd = 0; - double fVal = ::rtl::math::stringToDouble(aParsable, '.', 0, - &eStatus, &nParseEnd); - - if (eStatus != rtl_math_ConversionStatus_Ok || - nParseEnd != (sal_Int32)aParsable.getLength()) - { - PushIllegalArgument(); - return; - } - - // Step 6: Apply percent signs - for (sal_Int32 i = 0; i < nPercentCount; ++i) - fVal /= 100.0; - - PushDouble(fVal); - } -} diff --git a/main/sc/source/core/tool/parclass.cxx b/main/sc/source/core/tool/parclass.cxx index 6159ae23eb..972874478d 100644 --- a/main/sc/source/core/tool/parclass.cxx +++ b/main/sc/source/core/tool/parclass.cxx @@ -571,8 +571,8 @@ void ScParameterClassification::GenerateDocumentation() aStr += ")"; switch ( eOp ) { - case ocRRI: - aStr += " // RRI in English resource"; + case ocZGZ: + aStr += " // RRI in English resource, but ZGZ in English-only section"; break; case ocMultiArea: aStr += " // e.g. combined first parameter of INDEX() function, not a real function"; diff --git a/main/sc/source/filter/excel/xlformula.cxx b/main/sc/source/filter/excel/xlformula.cxx index 15a1fd30c9..c19f5d800b 100644 --- a/main/sc/source/filter/excel/xlformula.cxx +++ b/main/sc/source/filter/excel/xlformula.cxx @@ -208,6 +208,9 @@ static const XclFunctionInfo saFuncTable_2[] = { ocIsLogical, 198, 1, 1, V, { VR }, 0, 0 }, { ocDBCount2, 199, 3, 3, V, { RO, RR }, 0, 0 }, { ocCurrency, 204, 1, 2, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, + { ocFindB, 205, 2, 3, V, { VR }, 0, 0 }, + { ocSearchB, 206, 2, 3, V, { VR }, 0, 0 }, + { ocReplaceB, 207, 4, 4, V, { VR }, 0, 0 }, { ocLeftB, 208, 1, 2, V, { VR }, 0, 0 }, { ocRightB, 209, 1, 2, V, { VR }, 0, 0 }, { ocMidB, 210, 3, 3, V, { VR }, 0, 0 }, @@ -254,7 +257,8 @@ static const XclFunctionInfo saFuncTable_4[] = { ocRank, 216, 2, 3, V, { VR, RO, VR }, 0, 0 }, { ocGDA2, 247, 4, 5, V, { VR }, 0, 0 }, { ocFrequency, 252, 2, 2, A, { RA }, 0, 0 }, - { ocErrorType, 261, 1, 1, V, { VR }, 0, 0 }, + { ocErrorTypeODF, 261, 1, 1, V, { VR }, 0, 0 }, + { ocErrorType, 261, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 }, { ocAveDev, 269, 1, MX, V, { RX }, 0, 0 }, { ocBetaDist, 270, 3, 5, V, { VR }, 0, 0 }, { ocGammaLn, 271, 1, 1, V, { VR }, 0, 0 }, @@ -267,8 +271,8 @@ static const XclFunctionInfo saFuncTable_4[] = { ocKritBinom, 278, 3, 3, V, { VR }, 0, 0 }, { ocEven, 279, 1, 1, V, { VR }, 0, 0 }, { ocExpDist, 280, 3, 3, V, { VR }, 0, 0 }, - { ocLegacyFDist, 281, 3, 3, V, { VR }, 0, 0 }, - { ocLegacyFInv, 282, 3, 3, V, { VR }, 0, 0 }, + { ocFDist, 281, 3, 3, V, { VR }, 0, 0 }, + { ocFInv, 282, 3, 3, V, { VR }, 0, 0 }, { ocFisher, 283, 1, 1, V, { VR }, 0, 0 }, { ocFisherInv, 284, 1, 1, V, { VR }, 0, 0 }, { ocFloor, 285, 2, 2, V, { VR, VR, C }, 0, 0 }, @@ -339,7 +343,7 @@ static const XclFunctionInfo saFuncTable_5[] = { ocCountIf, 346, 2, 2, V, { RO, VR }, 0, 0 }, { ocCountEmptyCells, 347, 1, 1, V, { RO }, 0, 0 }, { ocISPMT, 350, 4, 4, V, { VR }, 0, 0 }, - { ocDateDif, 351, 3, 3, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // DATEDIF + { ocDateDif, 351, 3, 3, V, { VR }, 0, 0 }, { ocNoName, 352, 1, 1, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // DATESTRING { ocNoName, 353, 2, 2, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // NUMBERSTRING { ocRoman, 354, 1, 2, V, { VR }, 0, 0 } @@ -378,6 +382,12 @@ static const XclFunctionInfo saFuncTable_Oox[] = { ocIfna, 255, 3, 3, V, { RO_E, VO, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "IFNA" ) }, { ocIfError, NOID, 2, 2, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "IFERROR" ) }, { ocIfError, 255, 3, 3, V, { RO_E, VO, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "IFERROR" ) }, + { ocFDistLeft, NOID, 3, 4, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "F.DIST" ) }, + { ocFDistLeft, 255, 4, 5, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "F.DIST" ) }, + { ocFInvLeft, NOID, 3, 3, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "F.INV" ) }, + { ocFInvLeft, 255, 4, 4, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "F.INV" ) }, + { ocIsoWeekNum, NOID, 1, 1, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "ISOWEEKNUM" ) }, + { ocIsoWeekNum, 255, 2, 2, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "ISOWEEKNUM" ) }, { ocSkewP, NOID, 1, MX, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "SKEW.P" ) }, { ocSkewP, 255, 2, MX, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "SKEW.P" ) }, { ocBitAnd, NOID, 2, 2, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "BITAND" ) }, @@ -407,19 +417,20 @@ static const XclFunctionInfo saFuncTable_Odf[] = EXC_FUNCENTRY_ODF( ocKombin2, 2, 2, 0, "COMBINA" ), EXC_FUNCENTRY_ODF( ocGetDiffDate, 2, 2, 0, "DAYS" ), EXC_FUNCENTRY_ODF( ocDecimal, 2, 2, 0, "DECIMAL" ), - EXC_FUNCENTRY_ODF( ocFDist, 3, 4, 0, "FDIST" ), - EXC_FUNCENTRY_ODF( ocFInv, 3, 3, 0, "FINV" ), + // Older versions wrote the legacy right-tail FDIST and FINV under these names. + { ocFDist, NOID, 3, 3, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME_ODF( "FDIST" ) }, + { ocFInv, NOID, 3, 3, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME_ODF( "FINV" ) }, EXC_FUNCENTRY_ODF( ocFormula, 1, 1, 0, "FORMULA" ), EXC_FUNCENTRY_ODF( ocGamma, 1, 1, 0, "GAMMA" ), EXC_FUNCENTRY_ODF( ocGauss, 1, 1, 0, "GAUSS" ), EXC_FUNCENTRY_ODF( ocIsFormula, 1, 1, 0, "ISFORMULA" ), EXC_FUNCENTRY_ODF( ocWeek, 1, 2, 0, "ISOWEEKNUM" ), EXC_FUNCENTRY_ODF( ocMatrixUnit, 1, 1, 0, "MUNIT" ), - EXC_FUNCENTRY_ODF( ocNumberValue, 2, 2, 0, "NUMBERVALUE" ), + EXC_FUNCENTRY_ODF( ocNumberValue, 1, 3, 0, "NUMBERVALUE" ), EXC_FUNCENTRY_ODF( ocLaufz, 3, 3, 0, "PDURATION" ), EXC_FUNCENTRY_ODF( ocVariationen2, 2, 2, 0, "PERMUTATIONA" ), EXC_FUNCENTRY_ODF( ocPhi, 1, 1, 0, "PHI" ), - EXC_FUNCENTRY_ODF( ocRRI, 3, 3, 0, "RRI" ), + EXC_FUNCENTRY_ODF( ocZGZ, 3, 3, 0, "RRI" ), EXC_FUNCENTRY_ODF( ocTable, 0, 1, 0, "SHEET" ), EXC_FUNCENTRY_ODF( ocTables, 0, 1, 0, "SHEETS" ), EXC_FUNCENTRY_ODF( ocUnichar, 1, 1, 0, "UNICHAR" ), diff --git a/main/sc/source/filter/qpro/qproform.cxx b/main/sc/source/filter/qpro/qproform.cxx index ac925f5c30..da3f1a62ce 100644 --- a/main/sc/source/filter/qpro/qproform.cxx +++ b/main/sc/source/filter/qpro/qproform.cxx @@ -149,7 +149,7 @@ void QProToSc::DoFunc( DefTokenId eOc, sal_uInt16 nArgs, const sal_Char* pExtStr sal_Int16 nNull = -1; sal_Int16 nLast = nArgs- 1; - if( eOc == ocRRI ) + if( eOc == ocZGZ ) aPool << eParam[ 2 ] << ocSep << eParam[ 1 ] << ocSep << eParam[ 0 ]; if( eOc == ocZinsZ ) aPool << eParam[ 3 ] << ocSep << eParam[ 2 ] << ocSep << eParam[ 1 ] << ocSep << eParam[ 0 ]; @@ -504,7 +504,7 @@ static const struct { ocExact, FT_FuncFix2 }, { ocNoName, FT_NotImpl }, // Call() { ocIndirect, FT_FuncFix1 }, - { ocRRI, FT_FuncFix3 }, // Interest + { ocZGZ, FT_FuncFix3 }, // Interest { ocNoName, FT_NotImpl }, { ocNoName, FT_NotImpl }, { ocLIA, FT_FuncFix3 }, diff --git a/main/sc/source/ui/src/scfuncs.src b/main/sc/source/ui/src/scfuncs.src index 7538bca6c2..cd2aaa465b 100644 --- a/main/sc/source/ui/src/scfuncs.src +++ b/main/sc/source/ui/src/scfuncs.src @@ -1012,7 +1012,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 0; ID_FUNCTION_GRP_DATETIME; U2S( HID_FUNC_ISOWEEKNUM ); - 1; 0; 0; + 1; 0; 0; }; String 2 // Name of Parameter 1 @@ -2184,18 +2184,18 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 Text [ en-US ] = "The future value of the investment." ; }; }; - // -=*# Resource for function RRI #*=- - Resource SC_OPCODE_RRI + // -=*# Resource for function ZGZ #*=- + Resource SC_OPCODE_ZGZ { String 1 // Description { - Text [ en-US ] = "Calculates the equivalent interest rate for the growth of an investment." ; + Text [ en-US ] = "Interest. Calculates the interest rate which represents the rate of return from an investment." ; }; ExtraData = { 0; ID_FUNCTION_GRP_FINANZ; - U2S( HID_FUNC_RRI ); + U2S( HID_FUNC_ZGZ ); 3; 0; 0; 0; 0; }; @@ -2205,23 +2205,23 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 }; String 3 // Description of Parameter 1 { - Text [ en-US ] = "The number of periods." ; + Text [ en-US ] = "The number of periods used in the calculation." ; }; String 4 // Name of Parameter 2 { - Text [ en-US ] = "PV" ; + Text [ en-US ] = "pv" ; }; String 5 // Description of Parameter 2 { - Text [ en-US ] = "Present value of the investment." ; + Text [ en-US ] = "Present value. The current value of the investment." ; }; String 6 // Name of Parameter 3 { - Text [ en-US ] = "Fv" ; + Text [ en-US ] = "FV" ; }; String 7 // Description of Parameter 3 { - Text [ en-US ] = "Future value of the investment." ; + Text [ en-US ] = "The future value of the investment." ; }; }; // -=*# Resource for function ISTBEZUG #*=- @@ -6671,7 +6671,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 0; ID_FUNCTION_GRP_STATISTIC; U2S( HID_FUNC_HYPGEOMVERT ); - 5; 0; 0; 0; 0; + 5; 0; 0; 0; 0; 1; 0; }; String 2 // Name of Parameter 1 @@ -6712,7 +6712,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 11 // Description of Parameter 5 { - Text [ en-US ] = "If TRUE (default), returns the cumulative distribution function; if FALSE, returns the probability mass function." ; + Text [ en-US ] = "0 or FALSE or omitted calculates the probability mass function. Any other value or TRUE calculates the cumulative distribution function." ; }; }; // -=*# Resource for function TVERT #*=- @@ -6798,8 +6798,8 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 { 0; ID_FUNCTION_GRP_STATISTIC; - U2S( HID_FUNC_FDIST ); - 4; 0; 0; 0; + U2S( HID_FUNC_FVERT ); + 3; 0; 0; 0; 0; }; String 2 // Name of Parameter 1 @@ -6826,14 +6826,6 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 { Text [ en-US ] = "The degrees of freedom in the denominator of the F distribution." ; }; - String 8 // Name of Parameter 4 - { - Text [ en-US ] = "cumulative" ; - }; - String 9 // Description of Parameter 4 - { - Text [ en-US ] = "If TRUE, the cumulative distribution function is returned; if FALSE, the probability density function is returned. Default is TRUE." ; - }; }; // -=*# Resource for function FINV #*=- Resource SC_OPCODE_F_INV @@ -6875,19 +6867,19 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 Text [ en-US ] = "The degrees of freedom in the denominator of the F distribution." ; }; }; - // -=*# Resource for function LEGACY.FDIST #*=- - Resource SC_OPCODE_LEGACY_F_DIST + // -=*# Resource for function F.DIST #*=- + Resource SC_OPCODE_F_DIST_LEFT { String 1 // Description { - Text [ en-US ] = "Values of the right-tailed F probability distribution (legacy)." ; + Text [ en-US ] = "Values of the left-tailed F probability distribution." ; }; ExtraData = { 0; ID_FUNCTION_GRP_STATISTIC; - U2S( HID_FUNC_LEGACY_FDIST ); - 4; 0; 0; 0; + U2S( HID_FUNC_F_DIST_LEFT ); + 4; 0; 0; 0; 1; 0; }; String 2 // Name of Parameter 1 @@ -6916,25 +6908,25 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 8 // Name of Parameter 4 { - Text [ en-US ] = "cumulative" ; + Text [ en-US ] = "Cumulative" ; }; String 9 // Description of Parameter 4 { - Text [ en-US ] = "If TRUE (default), the right-tailed cumulative distribution function is returned; if FALSE, the probability density function is returned." ; + Text [ en-US ] = "0 or FALSE calculates the probability density function. Any other value or TRUE or omitted calculates the cumulative distribution function." ; }; }; - // -=*# Resource for function LEGACY.FINV #*=- - Resource SC_OPCODE_LEGACY_F_INV + // -=*# Resource for function F.INV #*=- + Resource SC_OPCODE_F_INV_LEFT { String 1 // Description { - Text [ en-US ] = "Values of the inverse right-tailed F probability distribution (legacy)." ; + Text [ en-US ] = "Values of the inverse left-tailed F distribution." ; }; ExtraData = { 0; ID_FUNCTION_GRP_STATISTIC; - U2S( HID_FUNC_LEGACY_FINV ); + U2S( HID_FUNC_F_INV_LEFT ); 3; 0; 0; 0; 0; }; @@ -6944,7 +6936,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 3 // Description of Parameter 1 { - Text [ en-US ] = "The probability value for which the inverse right-tailed F distribution is to be calculated." ; + Text [ en-US ] = "The probability value for which the inverse left-tailed F distribution is to be calculated." ; }; String 4 // Name of Parameter 2 { @@ -8256,6 +8248,30 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 Text [ en-US ] = "The reference (cell) in which the error occurred." ; }; }; + // -=*# Resource for function ERROR.TYPE #*=- + Resource SC_OPCODE_ERROR_TYPE_ODF + { + String 1 // Description + { + Text [ en-US ] = "Returns a number from 1 to 7 for the kind of error value" ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_TABLE; + U2S( HID_FUNC_ERROR_TYPE_ODF ); + 1; 0; + 0; + }; + String 2 // Name of Parameter 1 + { + Text [ en-US ] = "reference" ; + }; + String 3 // Description of Parameter 1 + { + Text [ en-US ] = "The reference (cell) in which the error occurred." ; + }; + }; // -=*# Resource for function VORLAGE #*=- Resource SC_OPCODE_STYLE { @@ -9496,16 +9512,16 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 { String 1 // Description { - Text [ en-US ] = "Converts text to a number using explicitly specified decimal and group separators." ; + Text [ en-US ] = "Converts text to a number, in a locale-independent way." ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_TEXT; + U2S( HID_FUNC_NUMBERVALUE ); + 3; 0; 1; 1; + 0; }; -ExtraData = - { - 0; - ID_FUNCTION_GRP_TEXT; - U2S( HID_FUNC_NUMBERVALUE ); - 3; 0; 0; - 0; - }; String 2 // Name of Parameter 1 { Text [ en-US ] = "text" ; @@ -9516,11 +9532,11 @@ ExtraData = }; String 4 // Name of Parameter 2 { - Text [ en-US ] = "decimal_separator" ; + Text [ en-US ] = "decimal_point" ; }; String 5 // Description of Parameter 2 { - Text [ en-US ] = "Defines the character used as the decimal separator." ; + Text [ en-US ] = "Defines the character used as the decimal point." ; }; String 6 // Name of Parameter 3 { @@ -9528,7 +9544,7 @@ ExtraData = }; String 7 // Description of Parameter 3 { - Text [ en-US ] = "Defines the character used as the group (thousands) separator." ; + Text [ en-US ] = "Defines the characters used as group separators." ; }; }; Resource SC_OPCODE_LENB diff --git a/main/sc/util/hidother.src b/main/sc/util/hidother.src index 87dd143369..c546ec78e0 100644 --- a/main/sc/util/hidother.src +++ b/main/sc/util/hidother.src @@ -134,7 +134,6 @@ hidspecial HID_FUNC_QIKV { HelpID = HID_FUNC_QIKV; }; hidspecial HID_FUNC_ISPMT { HelpID = HID_FUNC_ISPMT; }; hidspecial HID_FUNC_LAUFZEIT { HelpID = HID_FUNC_LAUFZEIT; }; hidspecial HID_FUNC_ZGZ { HelpID = HID_FUNC_ZGZ; }; -hidspecial HID_FUNC_RRI { HelpID = HID_FUNC_RRI; }; hidspecial HID_FUNC_ISTBEZUG { HelpID = HID_FUNC_ISTBEZUG; }; hidspecial HID_FUNC_ISTFEHL { HelpID = HID_FUNC_ISTFEHL; }; hidspecial HID_FUNC_ISTFEHLER { HelpID = HID_FUNC_ISTFEHLER; }; @@ -283,10 +282,9 @@ hidspecial HID_FUNC_HYPGEOMVERT { HelpID = HID_FUNC_HYPGEOMVERT; }; hidspecial HID_FUNC_TVERT { HelpID = HID_FUNC_TVERT; }; hidspecial HID_FUNC_TINV { HelpID = HID_FUNC_TINV; }; hidspecial HID_FUNC_FVERT { HelpID = HID_FUNC_FVERT; }; -hidspecial HID_FUNC_FDIST { HelpID = HID_FUNC_FDIST; }; -hidspecial HID_FUNC_LEGACY_FDIST { HelpID = HID_FUNC_LEGACY_FDIST; }; +hidspecial HID_FUNC_F_DIST_LEFT { HelpID = HID_FUNC_F_DIST_LEFT; }; hidspecial HID_FUNC_FINV { HelpID = HID_FUNC_FINV; }; -hidspecial HID_FUNC_LEGACY_FINV { HelpID = HID_FUNC_LEGACY_FINV; }; +hidspecial HID_FUNC_F_INV_LEFT { HelpID = HID_FUNC_F_INV_LEFT; }; hidspecial HID_FUNC_CHIVERT { HelpID = HID_FUNC_CHIVERT; }; hidspecial HID_FUNC_CHIINV { HelpID = HID_FUNC_CHIINV; }; hidspecial HID_FUNC_STANDARDISIERUNG { HelpID = HID_FUNC_STANDARDISIERUNG; }; @@ -327,6 +325,7 @@ hidspecial HID_FUNC_VERWEIS { HelpID = HID_FUNC_VERWEIS; }; hidspecial HID_FUNC_VERGLEICH { HelpID = HID_FUNC_VERGLEICH; }; hidspecial HID_FUNC_VERSCHIEBUNG { HelpID = HID_FUNC_VERSCHIEBUNG; }; hidspecial HID_FUNC_FEHLERTYP { HelpID = HID_FUNC_FEHLERTYP; }; +hidspecial HID_FUNC_ERROR_TYPE_ODF { HelpID = HID_FUNC_ERROR_TYPE_ODF; }; hidspecial HID_FUNC_VORLAGE { HelpID = HID_FUNC_VORLAGE; }; hidspecial HID_FUNC_DDE { HelpID = HID_FUNC_DDE; }; hidspecial HID_FUNC_TABELLE { HelpID = HID_FUNC_TABELLE; };
