xref: /trunk/audit/openformula-function-gaps/function-source-audit.md (revision 195598447694ec8542914a9b51ae9942e8ebacd9) !
14f909564SJim Jagielski<!--
24f909564SJim Jagielski Licensed to the Apache Software Foundation (ASF) under one
34f909564SJim Jagielski or more contributor license agreements.  See the NOTICE file
44f909564SJim Jagielski distributed with this work for additional information
54f909564SJim Jagielski regarding copyright ownership.  The ASF licenses this file
64f909564SJim Jagielski to you under the Apache License, Version 2.0 (the
74f909564SJim Jagielski "License"); you may not use this file except in compliance
84f909564SJim Jagielski with the License.  You may obtain a copy of the License at
94f909564SJim Jagielski
104f909564SJim Jagielski   http://www.apache.org/licenses/LICENSE-2.0
114f909564SJim Jagielski
124f909564SJim Jagielski Unless required by applicable law or agreed to in writing,
134f909564SJim Jagielski software distributed under the License is distributed on an
144f909564SJim Jagielski "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
154f909564SJim Jagielski KIND, either express or implied.  See the License for the
164f909564SJim Jagielski specific language governing permissions and limitations
174f909564SJim Jagielski under the License.
184f909564SJim Jagielski-->
194f909564SJim Jagielski
200224e3dcSPedro GiffuniOpenFormula Function Compatibility Gap Audit — Source-Level Findings
210224e3dcSPedro Giffuni=====================================================================
220224e3dcSPedro Giffuni
230224e3dcSPedro GiffuniBranch: openformula
240224e3dcSPedro GiffuniStarting commit: 6a2f742073 (CONVERT atm/Torr fix)
250224e3dcSPedro GiffuniPR #523 merge: 1354dfcdad
260224e3dcSPedro GiffuniAudit type: Read-only source inspection (no build, no runtime execution)
270224e3dcSPedro Giffuni
280224e3dcSPedro GiffuniThis document records source-level findings for 15 Calc functions.
290224e3dcSPedro GiffuniAll file paths and line numbers are relative to the repository root
300224e3dcSPedro Giffuni(/home/pedro/projects/aoo).
310224e3dcSPedro Giffuni
324f909564SJim JagielskiUpdated 2026-11-18 to match the code after the post-merge review. Line
334f909564SJim Jagielskinumbers are those of the 2026-11-18 working tree. "Run" means the working
344f909564SJim Jagielskitree was built on macOS and Linux and the case was run; "Excel 16" means it
354f909564SJim Jagielskiwas also compared with Excel. Sections 6, 12 and 15 were only re-read.
360224e3dcSPedro Giffuni
374f909564SJim Jagielski1\. FINDB
380224e3dcSPedro Giffuni--------
390224e3dcSPedro Giffuni
404f909564SJim JagielskiODF 1.4: Defined (§6.7.2 in ODF 1.2 and 1.4: "The same as FIND, but using
414f909564SJim Jagielski  byte positions"). Byte positions are implementation-dependent.
424f909564SJim JagielskiODF group: not checked.
430224e3dcSPedro Giffuni
440224e3dcSPedro GiffuniA. Function registration
454f909564SJim Jagielski
464f909564SJim Jagielski- Native opcode: SC_OPCODE_FINDB = 412 (compiler.hrc line 408).
470224e3dcSPedro Giffuni- Parser name: "FINDB" registered in core_resource.src (ODF and
480224e3dcSPedro Giffuni    Excel sections).
494f909564SJim Jagielski- Function-name-to-opcode mapping: ocFindB → FINDB (opcode.hxx
504f909564SJim Jagielski    line 307).
510224e3dcSPedro Giffuni- Evaluator implementation: ScInterpreter::ScFindB() at
524f909564SJim Jagielski    main/sc/source/core/tool/interpr1.cxx:8260. Dispatch via
534f909564SJim Jagielski    `case ocFindB : ScFindB();` at interpr4.cxx:3774.
540224e3dcSPedro Giffuni- Function parameter metadata: Via native function resource.
554f909564SJim Jagielski- Help entry: HID_FUNC_FINDB (helpids.h line 769, hidother.src);
564f909564SJim Jagielski    topic func_findb.xhp.
570224e3dcSPedro Giffuni- ODF formula namespace mapping: FINDB in ODF section of
580224e3dcSPedro Giffuni    core_resource.src.
594f909564SJim Jagielski- Excel import/export mapping: BIFF2 ID 205 (xlformula.cxx line 211),
604f909564SJim Jagielski    added 2026-11-18. xlsx: ODF name FINDB (formulabase.cxx line 442).
610224e3dcSPedro Giffuni
624f909564SJim JagielskiB. Actual implementation: ScInterpreter::ScFindB() at interpr1.cxx:8260.
630224e3dcSPedro Giffuni  Implements case-sensitive byte-oriented search using DBCS byte
640224e3dcSPedro Giffuni  semantics (1 byte for ASCII/non-DBCS, 2 bytes for DBCS characters
650224e3dcSPedro Giffuni  per IsDBCS()). Uses lcl_BytePosToCharIndex() and
660224e3dcSPedro Giffuni  lcl_CharIndexToBytePos() helpers to convert between byte positions
670224e3dcSPedro Giffuni  (1-based) and character indices (0-based). Returns byte position
684f909564SJim Jagielski  of match, or #VALUE! (PushNoValue) if not found or start invalid.
694f909564SJim Jagielski  Until 2026-11-18 the two text arguments were popped in the wrong
704f909564SJim Jagielski  order, so FINDB("b";"abc") searched "b" for "abc".
710224e3dcSPedro Giffuni
724f909564SJim JagielskiC. Format compatibility: XLS read and written as BIFF 205; an AOO xls
734f909564SJim Jagielski  opens in Excel 16 with the value (run). XLSX read (run, hand-made
744f909564SJim Jagielski  file). AOO has no xlsx export.
750224e3dcSPedro Giffuni
764f909564SJim JagielskiD. Documentation: Help topic func_findb.xhp, reachable through its help
774f909564SJim Jagielski  ID since helpcontent2/util/scalc/makefile.mk lists it (2026-11-18).
780224e3dcSPedro Giffuni  Function Wizard entry exists in main/sc/source/ui/src/scfuncs.src
790224e3dcSPedro Giffuni  (SC_OPCODE_FINDB resource block with parameter names and descriptions).
800224e3dcSPedro Giffuni
814f909564SJim JagielskiFailure type: None.
820224e3dcSPedro GiffuniPriority: Resolved (was P1).
834f909564SJim JagielskiConfidence: HIGH — run; ASCII cases match Excel 16 (Excel counts CJK as
844f909564SJim Jagielski            1 byte unless a DBCS language is set; AOO always 2).
850224e3dcSPedro Giffuni
864f909564SJim Jagielski2\. REPLACEB
870224e3dcSPedro Giffuni-----------
880224e3dcSPedro Giffuni
894f909564SJim JagielskiODF 1.4: Defined (§6.7.6: "As REPLACE, but using byte positions").
904f909564SJim JagielskiODF group: not checked.
910224e3dcSPedro Giffuni
920224e3dcSPedro GiffuniA. Function registration
934f909564SJim Jagielski
944f909564SJim Jagielski- Native opcode: SC_OPCODE_REPLACEB = 414 (compiler.hrc line 410).
950224e3dcSPedro Giffuni- Parser name: "REPLACEB" registered in core_resource.src (ODF and
960224e3dcSPedro Giffuni    Excel sections).
970224e3dcSPedro Giffuni- Function-name-to-opcode mapping: ocReplaceB → REPLACEB
984f909564SJim Jagielski    (opcode.hxx line 309).
990224e3dcSPedro Giffuni- Evaluator implementation: ScInterpreter::ScReplaceB() at
1004f909564SJim Jagielski    interpr1.cxx:8355. Dispatch via
1014f909564SJim Jagielski    `case ocReplaceB : ScReplaceB();` at interpr4.cxx:3776.
1020224e3dcSPedro Giffuni- Function parameter metadata: Via native function resource.
1034f909564SJim Jagielski- Help entry: HID_FUNC_REPLACEB (helpids.h line 771, hidother.src);
1044f909564SJim Jagielski    topic func_replaceb.xhp.
1050224e3dcSPedro Giffuni- ODF formula namespace mapping: REPLACEB in ODF section of
1060224e3dcSPedro Giffuni    core_resource.src.
1074f909564SJim Jagielski- Excel import/export mapping: BIFF2 ID 207 (xlformula.cxx line 213),
1084f909564SJim Jagielski    added 2026-11-18. xlsx: formulabase.cxx line 444.
1090224e3dcSPedro Giffuni
1104f909564SJim JagielskiB. Actual implementation: ScInterpreter::ScReplaceB() at interpr1.cxx:8355.
1110224e3dcSPedro Giffuni  Implements byte-oriented replacement using DBCS byte semantics.
1120224e3dcSPedro Giffuni  Converts start byte position to character index, counts bytes
1130224e3dcSPedro Giffuni  forward to determine character count to erase (avoiding splitting
1140224e3dcSPedro Giffuni  DBCS characters), then Erase/Insert like ScReplace(). Clamps
1150224e3dcSPedro Giffuni  start position to string length + 1 (append at end) and clamps
1160224e3dcSPedro Giffuni  count to available bytes. Returns PushIllegalArgument() for invalid
1170224e3dcSPedro Giffuni  inputs.
1180224e3dcSPedro Giffuni
1194f909564SJim JagielskiC. Format compatibility: XLS read and written as BIFF 207 (source).
1204f909564SJim Jagielski  XLSX read (run).
1210224e3dcSPedro Giffuni
1224f909564SJim JagielskiD. Documentation: Help topic func_replaceb.xhp (help ID resolves since
1234f909564SJim Jagielski  2026-11-18). Function Wizard entry exists in scfuncs.src.
1240224e3dcSPedro Giffuni
1254f909564SJim JagielskiFailure type: None.
1260224e3dcSPedro GiffuniPriority: Resolved (was P1).
1274f909564SJim JagielskiConfidence: HIGH — run; ASCII cases match Excel 16.
1280224e3dcSPedro Giffuni
1294f909564SJim Jagielski3\. SEARCHB
1300224e3dcSPedro Giffuni----------
1310224e3dcSPedro Giffuni
1324f909564SJim JagielskiODF 1.4: Defined (§6.7.8: "As SEARCH, but using byte positions").
1334f909564SJim JagielskiODF group: not checked.
1340224e3dcSPedro Giffuni
1350224e3dcSPedro GiffuniA. Function registration
1364f909564SJim Jagielski
1374f909564SJim Jagielski- Native opcode: SC_OPCODE_SEARCHB = 413 (compiler.hrc line 409).
1380224e3dcSPedro Giffuni- Parser name: "SEARCHB" registered in core_resource.src (ODF and
1390224e3dcSPedro Giffuni    Excel sections).
1400224e3dcSPedro Giffuni- Function-name-to-opcode mapping: ocSearchB → SEARCHB
1414f909564SJim Jagielski    (opcode.hxx line 308).
1420224e3dcSPedro Giffuni- Evaluator implementation: ScInterpreter::ScSearchB() at
1434f909564SJim Jagielski    interpr1.cxx:8302. Dispatch via
1444f909564SJim Jagielski    `case ocSearchB : ScSearchB();` at interpr4.cxx:3775.
1450224e3dcSPedro Giffuni- Function parameter metadata: Via native function resource.
1464f909564SJim Jagielski- Help entry: HID_FUNC_SEARCHB (helpids.h line 770, hidother.src);
1474f909564SJim Jagielski    topic func_searchb.xhp.
1480224e3dcSPedro Giffuni- ODF formula namespace mapping: SEARCHB in ODF section of
1490224e3dcSPedro Giffuni    core_resource.src.
1504f909564SJim Jagielski- Excel import/export mapping: BIFF2 ID 206 (xlformula.cxx line 212),
1514f909564SJim Jagielski    added 2026-11-18. xlsx: formulabase.cxx line 443.
1520224e3dcSPedro Giffuni
1534f909564SJim JagielskiB. Actual implementation: ScInterpreter::ScSearchB() at interpr1.cxx:8302.
1540224e3dcSPedro Giffuni  Implements case-insensitive byte-oriented search using DBCS byte
1550224e3dcSPedro Giffuni  semantics, following the same pattern as ScSearch() (utl::TextSearch
1564f909564SJim Jagielski  with case-insensitive flag; regular expressions when enabled, no ? or *
1574f909564SJim Jagielski  wildcards). Converts byte positions to/from character
1580224e3dcSPedro Giffuni  indices using lcl_BytePosToCharIndex() and lcl_CharIndexToBytePos().
1594f909564SJim Jagielski  Returns byte position of match, or #VALUE! (PushNoValue) if not found
1604f909564SJim Jagielski  or start invalid. The text arguments were popped in the wrong order
1614f909564SJim Jagielski  until 2026-11-18, as in FINDB.
1620224e3dcSPedro Giffuni
1634f909564SJim JagielskiC. Format compatibility: XLS read and written as BIFF 206 (source).
1644f909564SJim Jagielski  XLSX read (run).
1650224e3dcSPedro Giffuni
1664f909564SJim JagielskiD. Documentation: Help topic func_searchb.xhp (the wildcard claim and its
1674f909564SJim Jagielski  example were removed 2026-11-18). Function Wizard entry exists in
1684f909564SJim Jagielski  scfuncs.src.
1690224e3dcSPedro Giffuni
1704f909564SJim JagielskiFailure type: None.
1710224e3dcSPedro GiffuniPriority: Resolved (was P1).
1724f909564SJim JagielskiConfidence: HIGH — run; ASCII cases match Excel 16.
1730224e3dcSPedro Giffuni
1744f909564SJim Jagielski4\. DATEDIF
1750224e3dcSPedro Giffuni----------
1760224e3dcSPedro Giffuni
177f8b15cbbSPedro GiffuniODF 1.4: Defined by ODF 1.4 Part 4, Section 6.10.3.
1784f909564SJim JagielskiODF group: Large Group (Excel compatibility function; not rechecked).
1790224e3dcSPedro Giffuni
1800224e3dcSPedro GiffuniA. Function registration
1814f909564SJim Jagielski
1824f909564SJim Jagielski- Native opcode: SC_OPCODE_DATEDIF = 415 (compiler.hrc line 411).
183f8b15cbbSPedro Giffuni- Parser name: "DATEDIF" registered in core_resource.src (ODF and
184f8b15cbbSPedro Giffuni    Excel sections).
185f8b15cbbSPedro Giffuni- Function-name-to-opcode mapping: ocDateDif → DATEDIF (opcode.hxx
1864f909564SJim Jagielski    line 310).
187f8b15cbbSPedro Giffuni- Evaluator implementation: ScInterpreter::ScDateDif() at
1884f909564SJim Jagielski    main/sc/source/core/tool/interpr2.cxx:461. Dispatch via
1894f909564SJim Jagielski    `case ocDateDif : ScDateDif();` at interpr4.cxx:3777.
190f8b15cbbSPedro Giffuni- Function parameter metadata: Via native function resource.
1914f909564SJim Jagielski- Help entry: HID_FUNC_DATEDIF (helpids.h line 772, hidother.src);
1924f909564SJim Jagielski    topic func_datedif.xhp.
193f8b15cbbSPedro Giffuni- ODF formula namespace mapping: DATEDIF in ODF section of
194f8b15cbbSPedro Giffuni    core_resource.src.
1954f909564SJim Jagielski- Excel import/export mapping: BIFF5/BIFF7 function ID 351 maps to
1964f909564SJim Jagielski    ocDateDif both ways (xlformula.cxx line 346; the import-only flag
1974f909564SJim Jagielski    was dropped 2026-11-18). xlsx: formulabase.cxx line 671.
1980224e3dcSPedro Giffuni
1994f909564SJim JagielskiB. Actual implementation: ScInterpreter::ScDateDif() at interpr2.cxx:461.
200f8b15cbbSPedro Giffuni  Implements ODF 1.4 §6.10.3 with all six formats (y, m, d, md, ym, yd).
2014f909564SJim Jagielski  Since 2026-11-18 (Jim's decision) it follows Excel where ODF is
2024f909564SJim Jagielski  silent: start after end is an error, the format ignores case, "md"
2034f909564SJim Jagielski  borrows the month before the end month and "yd" moves the end date into
2044f909564SJim Jagielski  the start year. The H.3 version negated reverse intervals, was
2054f909564SJim Jagielski  case-sensitive and computed "yd" wrongly.
206f8b15cbbSPedro Giffuni  Detailed algorithm in audit/openformula-function-gaps/datedif-semantic-design.md.
2070224e3dcSPedro Giffuni
2080224e3dcSPedro GiffuniC. Format compatibility
2090224e3dcSPedro Giffuni
2104f909564SJim Jagielski- XLS import and export: BIFF ID 351 (run; Excel 16 calculates an AOO
2114f909564SJim Jagielski    xls).
2124f909564SJim Jagielski- XLSX import: read (run).
2134f909564SJim Jagielski- XLSX export: AOO has none.
2140224e3dcSPedro Giffuni
2154f909564SJim JagielskiD. Documentation: Help topic func_datedif.xhp (rewritten 2026-11-18).
2164f909564SJim Jagielski  Function Wizard entry exists in main/sc/source/ui/src/scfuncs.src.
2174f909564SJim Jagielski
2184f909564SJim JagielskiFailure type: None. One Excel difference ("yd" from Feb 29, 2020 to
2194f909564SJim Jagielski  Mar 1, 2023).
220f8b15cbbSPedro GiffuniPriority: Resolved (was P1).
2214f909564SJim JagielskiConfidence: HIGH — run; 630 cases compared with Excel 16.
2220224e3dcSPedro Giffuni
2234f909564SJim Jagielski5\. ISOWEEKNUM
2240224e3dcSPedro Giffuni-------------
2250224e3dcSPedro Giffuni
2264f909564SJim JagielskiODF 1.4: Defined (ODF 1.2 §6.10.11, ODF 1.4 §6.10.12): one argument,
2274f909564SJim Jagielski  ISO 8601 week. No Mode parameter in either version.
2284f909564SJim JagielskiODF group: not checked.
2290224e3dcSPedro Giffuni
2300224e3dcSPedro GiffuniA. Function registration
2310224e3dcSPedro Giffuni
2324f909564SJim Jagielski- Native opcode: SC_OPCODE_ISOWEEKNUM = 416 (compiler.hrc line 412),
2334f909564SJim Jagielski    added in H.5. WEEKNUM is SC_OPCODE_WEEK.
2344f909564SJim Jagielski- Function-name-to-opcode mapping: ocIsoWeekNum → ISOWEEKNUM
2354f909564SJim Jagielski    (opcode.hxx line 311; core_resource.src lines 340, 693 and 1635).
2364f909564SJim Jagielski    The ODF list also maps ocWeek to "ISOWEEKNUM" (line 339), which is
2374f909564SJim Jagielski    how AOO has always written WEEKNUM(d;mode) to ODF; when reading, the
2384f909564SJim Jagielski    first entry wins, so FormulaCompiler::Factor (FormulaCompiler.cxx
2394f909564SJim Jagielski    line 1083) turns an ODF ISOWEEKNUM with one argument into
2404f909564SJim Jagielski    ocIsoWeekNum (2026-11-18). With two arguments it stays WEEKNUM.
2414f909564SJim Jagielski- Evaluator implementation: ScIsoWeekNum() at interpr2.cxx:240,
2424f909564SJim Jagielski    Date::GetWeekOfYear(MONDAY, 4). WEEKNUM is ScGetWeekOfYear() at
2434f909564SJim Jagielski    interpr2.cxx:227 and still takes exactly 2 arguments.
2444f909564SJim Jagielski- Help entry: HID_FUNC_ISOWEEKNUM (helpids.h line 506, hidother.src);
2454f909564SJim Jagielski    topic func_isoweeknum.xhp.
2464f909564SJim Jagielski- Excel mapping: `_xlfn.ISOWEEKNUM` in saFuncTable_Oox (xlformula.cxx
2474f909564SJim Jagielski    lines 385-386), added 2026-11-18. WEEKNUM keeps the
2484f909564SJim Jagielski    `_xlfnodf.ISOWEEKNUM` entry (line 422).
2494f909564SJim Jagielski
2504f909564SJim JagielskiB. Actual implementation: ISO 8601 (Monday start, week 1 holds the
2514f909564SJim Jagielski  first Thursday). The Function Wizard resource had one ExtraData number
2524f909564SJim Jagielski  too many; fixed 2026-11-18.
2530224e3dcSPedro Giffuni
2540224e3dcSPedro GiffuniC. Format compatibility
2550224e3dcSPedro Giffuni
2564f909564SJim Jagielski- ODF: one-argument form read and written as ISOWEEKNUM; old files'
2574f909564SJim Jagielski    two-argument form read as WEEKNUM (run, .ods round trip).
2584f909564SJim Jagielski- XLS: written as `_xlfn.ISOWEEKNUM` and read back; Excel 16 calculates
2594f909564SJim Jagielski    it (run).
260*83f26b2aSJim Jagielski- XLSX import: `_xlfn.ISOWEEKNUM` is read (run, 2026-11-18).
2610224e3dcSPedro Giffuni
2624f909564SJim JagielskiD. Documentation: func_isoweeknum.xhp, embedded in 04060102.xhp; help
2634f909564SJim Jagielski  ID resolves since 2026-11-18.
264517a2e3bSPedro Giffuni
2654f909564SJim JagielskiFailure type: None (xlsx import gap above).
2664f909564SJim JagielskiPriority: Resolved (was P1).
2674f909564SJim JagielskiConfidence: HIGH — run; 300 dates compared with Excel 16.
2680224e3dcSPedro Giffuni
2694f909564SJim Jagielski6\. DDE
2704f909564SJim Jagielski------
2710224e3dcSPedro Giffuni
2724f909564SJim JagielskiODF 1.4: Not defined by ODF 1.4 Part 4 (not rechecked). Excel-specific /
2734f909564SJim Jagielski  application-level.
2740224e3dcSPedro GiffuniODF group: Not applicable.
2750224e3dcSPedro Giffuni
2760224e3dcSPedro GiffuniA. Function registration
2774f909564SJim Jagielski
2780224e3dcSPedro Giffuni- Native opcode: SC_OPCODE_DDE = 369 (compiler.hrc line 365).
2794f909564SJim Jagielski- Parser name: "DDE" in core_resource.src lines 345 (ODF) and 698 (Excel).
2800224e3dcSPedro Giffuni- Function-name-to-opcode mapping: ocDde → DDE.
2814f909564SJim Jagielski- Evaluator implementation: ScDde() at interpr2.cxx:2247.
2820224e3dcSPedro Giffuni    Takes 3–4 params: Item, Topic, Appl, [Mode].
2830224e3dcSPedro Giffuni- Function parameter metadata: Via native function resource.
2844f909564SJim Jagielski- Help entry: HID_FUNC_DDE (hidother.src:330, helpids.h:738).
2850224e3dcSPedro Giffuni- ODF formula namespace mapping: DDE in both ODF and Excel sections.
2860224e3dcSPedro Giffuni- Excel import mapping: Not in xlformula.cxx BIFF tables.
2870224e3dcSPedro Giffuni- Excel export mapping: None.
2880224e3dcSPedro Giffuni
2894f909564SJim JagielskiB. Actual implementation: ScDde() (interpr2.cxx:2247) creates or
2900224e3dcSPedro Giffuni  finds an ScDdeLink via sfx2::LinkManager. Requires a document shell
2910224e3dcSPedro Giffuni  with a LinkManager (fails with PushNoValue() for temporary documents
2920224e3dcSPedro Giffuni  without DocShell). Sets recalc mode on load. Disables idle during
2930224e3dcSPedro Giffuni  evaluation. DDE is platform-dependent (implemented via
2940224e3dcSPedro Giffuni  sfx2/source/appl/impldde.cxx, appdde.cxx). DDE links can be created
2950224e3dcSPedro Giffuni  new (not just opening existing links). Updates are driven by the
2960224e3dcSPedro Giffuni  DDE link mechanism, not automatic per-recalc. External application
2970224e3dcSPedro Giffuni  failures are handled via error codes. Security: no user confirmation
2980224e3dcSPedro Giffuni  visible in source; DDE is disabled in server mode
2990224e3dcSPedro Giffuni  (appdde.cxx:494, 526: "Im Serverbetrieb ist DDE abgeklemmt!").
3000224e3dcSPedro Giffuni
3010224e3dcSPedro GiffuniC. Format compatibility: DDE is not a file-format function per se;
3020224e3dcSPedro Giffuni  no XLS/XLSX import/export mapping for the DDE function itself.
3030224e3dcSPedro Giffuni  DDE links (external references) are handled separately in Excel
3040224e3dcSPedro Giffuni  filters (xilink.cxx, xelink.cxx, xehelper.cxx).
3050224e3dcSPedro Giffuni
3060224e3dcSPedro GiffuniD. Documentation: HID_FUNC_DDE help entry exists.
3070224e3dcSPedro Giffuni
3080224e3dcSPedro GiffuniFailure type: Platform-dependent application-level feature.
3090224e3dcSPedro Giffuni  Not a pure formula function; requires DDE subsystem availability.
3100224e3dcSPedro GiffuniPriority: DEFER — requires DDE service platform support; security
3110224e3dcSPedro Giffuni          and platform-appropriateness questions unresolved.
3120224e3dcSPedro GiffuniConfidence: HIGH — source evidence clear; implementation exists but
3130224e3dcSPedro Giffuni            is platform-dependent.
3140224e3dcSPedro Giffuni
3154f909564SJim Jagielski7\. ODDFPRICE
3160224e3dcSPedro Giffuni------------
3170224e3dcSPedro Giffuni
3184f909564SJim JagielskiODF 1.4: Defined (§6.12.31 in ODF 1.2 and 1.4). The spec gives no formula.
3194f909564SJim JagielskiODF group: not checked.
3200224e3dcSPedro Giffuni
3210224e3dcSPedro GiffuniA. Function registration
3224f909564SJim Jagielski
3234f909564SJim Jagielski- Native opcode: NONE. Not a native Calc opcode (H.6.1 added one and
3244f909564SJim Jagielski    f4f3de4f92 reverted it).
3250224e3dcSPedro Giffuni- Parser name: "ODDFPRICE" registered as AddIn in
3260224e3dcSPedro Giffuni    odffmap.cxx line 127:
3270224e3dcSPedro Giffuni      { "ODDFPRICE", "ODDFPRICE", false,
3280224e3dcSPedro Giffuni        "com.sun.star.sheet.addin.Analysis.getOddfprice",
3290224e3dcSPedro Giffuni        "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETODDFPRICE" }
3300224e3dcSPedro Giffuni- Function-name-to-opcode mapping: Via AddIn map, not native opcode.
3310224e3dcSPedro Giffuni- Evaluator implementation: AnalysisAddIn::getOddfprice() at
3324f909564SJim Jagielski    scaddins/source/analysis/financial.cxx:404. Validates
3338ce50c34SPedro Giffuni    fRate>=0, fYield>=0, fRedemp>0, frequency, nMat>nFirstCoup>nSettle>nIssue.
3344f909564SJim Jagielski    Delegates to GetOddfprice() (analysishelper.cxx:1038).
3350224e3dcSPedro Giffuni- Function parameter metadata: Via AddIn collection (ScUnoAddInCollection).
3364f909564SJim Jagielski- Help entry: HID_AAI_FUNC_ODDFPRICE (hidother.src:414, helpids.h:318);
3374f909564SJim Jagielski    English topic in 04060118.xhp.
3380224e3dcSPedro Giffuni- ODF formula namespace mapping: None (AddIn, not ODF namespace).
3390224e3dcSPedro Giffuni- Excel import mapping: Not in xlformula.cxx BIFF tables.
3400224e3dcSPedro Giffuni- Excel export mapping: None.
3410224e3dcSPedro Giffuni
3424f909564SJim JagielskiB. Actual implementation: on trunk GetOddfprice() threw (THROW_RTE,
3434f909564SJim Jagielski  #87380#). 8ce50c3485 (message "No production code changes") brought in
3444f909564SJim Jagielski  an unfinished version: the long-period terms were multiplied by 0 and a
3454f909564SJim Jagielski  placeholder line did not compile. Jim chose to finish it; the
3464f909564SJim Jagielski  2026-11-18 version:
3474f909564SJim Jagielski
3484f909564SJim Jagielski- Requires the first coupon to be on the maturity's coupon schedule
3494f909564SJim Jagielski    (lcl_GetCouppcd), as Excel does (#NUM! otherwise).
3504f909564SJim Jagielski- Short first period (DFC < E): Excel's short formula, DSC, A and DFC
3514f909564SJim Jagielski    counted with ScaDate::getDiff().
3524f909564SJim Jagielski- Long first period: Excel's long formula, summed per quasi-coupon
3534f909564SJim Jagielski    period; a whole quasi-coupon period inside the odd period counts as 1,
3544f909564SJim Jagielski    the quasi-coupon dates are stepped back by plain months, and Nq follows
3554f909564SJim Jagielski    Excel's count for month-end first coupons
3564f909564SJim Jagielski    (lcl_GetOddfQuasiPeriods()).
3574f909564SJim Jagielski  These rules were found by comparing with Excel 16, not taken from a
3584f909564SJim Jagielski  spec.
3590224e3dcSPedro Giffuni
3600224e3dcSPedro GiffuniC. Format compatibility: AddIn function; not part of BIFF/OOXML
3610224e3dcSPedro Giffuni  function tables. Import/export via AddIn mechanism only.
3620224e3dcSPedro Giffuni
3630224e3dcSPedro GiffuniD. Documentation: Help entry exists (AAI = Analysis AddIn).
3640224e3dcSPedro Giffuni
3654f909564SJim JagielskiFailure type: RESOLVED 2026-11-18 (was: throws unconditionally on trunk).
3664f909564SJim Jagielski  4524 random ODDFPRICE/ODDFYIELD cases compared with Excel 16: 14
3674f909564SJim Jagielski  differences in 4 classes (DFC equal to E where Excel gives #NUM!: 4;
3684f909564SJim Jagielski  annual 30/360 US bonds with Feb-end coupons, 2/360 of a coupon: 5;
3694f909564SJim Jagielski  Excel's yield less exact: 4; Excel's yield wrong: 1).
3704f909564SJim JagielskiPriority: P2 (native opcode deferred).
3714f909564SJim JagielskiConfidence: HIGH — run, Excel 16.
3720224e3dcSPedro Giffuni
3734f909564SJim Jagielski8\. ODDFYIELD
3740224e3dcSPedro Giffuni------------
3750224e3dcSPedro Giffuni
3764f909564SJim JagielskiODF 1.4: Defined (§6.12.32 in ODF 1.2 and 1.4).
3774f909564SJim JagielskiODF group: not checked.
3780224e3dcSPedro Giffuni
3790224e3dcSPedro GiffuniA. Function registration
3804f909564SJim Jagielski
3810224e3dcSPedro Giffuni- Native opcode: NONE.
3820224e3dcSPedro Giffuni- Parser name: "ODDFYIELD" registered as AddIn in odffmap.cxx line 128:
3830224e3dcSPedro Giffuni      { "ODDFYIELD", "ODDFYIELD", false,
3840224e3dcSPedro Giffuni        "com.sun.star.sheet.addin.Analysis.getOddfyield", ... }
3850224e3dcSPedro Giffuni- Evaluator implementation: AnalysisAddIn::getOddfyield() at
3864f909564SJim Jagielski    financial.cxx:416. Validates fRate>=0, fPrice>0, fRedemp>0 (added
3874f909564SJim Jagielski    2026-11-18), frequency, nMat>nFirstCoup>nSettle>nIssue. Delegates to
3884f909564SJim Jagielski    GetOddfyield() (analysishelper.cxx:1177).
3894f909564SJim Jagielski- Help entry: HID_AAI_FUNC_ODDFYIELD (hidother.src:415, helpids.h:319).
3900224e3dcSPedro Giffuni
3914f909564SJim JagielskiB. Actual Implementation: 2026-11-18. The price falls as the yield
3924f909564SJim Jagielski  rises, so GetOddfyield() brackets the yield (above -frequency) and
3934f909564SJim Jagielski  narrows it with the Illinois variant of regula falsi, stopping when the
3944f909564SJim Jagielski  price is within 1e-12 relative. No bracket or no convergence: #NUM!.
3950224e3dcSPedro Giffuni
3960224e3dcSPedro GiffuniC. Format compatibility: AddIn only; no BIFF/OOXML table mapping.
3970224e3dcSPedro Giffuni
3980224e3dcSPedro GiffuniD. Documentation: Help entry exists.
3990224e3dcSPedro Giffuni
4004f909564SJim JagielskiFailure type: RESOLVED 2026-11-18 (was: throws unconditionally on trunk).
4014f909564SJim Jagielski  See ODDFPRICE for the Excel comparison; where the yields differ,
4024f909564SJim Jagielski  AOO's reproduces the price within 1e-10 in Excel's own ODDFPRICE,
4034f909564SJim Jagielski  Excel's within 1.8e-7.
4044f909564SJim JagielskiPriority: P2 (native opcode deferred).
4054f909564SJim JagielskiConfidence: HIGH — run, Excel 16.
4060224e3dcSPedro Giffuni
4074f909564SJim Jagielski9\. RRI
4084f909564SJim Jagielski------
4090224e3dcSPedro Giffuni
4104f909564SJim JagielskiODF 1.4: Defined (§6.12.44 in ODF 1.2 and 1.4; constraint N > 0).
4114f909564SJim JagielskiODF group: not checked.
4120224e3dcSPedro Giffuni
4130224e3dcSPedro GiffuniA. Function registration
4140224e3dcSPedro Giffuni
4154f909564SJim Jagielski- Native opcode: SC_OPCODE_ZGZ = 256 (compiler.hrc line 252).
4164f909564SJim Jagielski- Parser names: "RRI" in the ODF and English lists since 2026-11-18
4174f909564SJim Jagielski    (core_resource.src lines 216 and 569; trunk had "ZGZ" there, so
4184f909564SJim Jagielski    older ODF files hold of:ZGZ). "ZGZ" is still read through
4194f909564SJim Jagielski    OpCodeMap::putOpCodeAlias() (FormulaCompiler.cxx line 695), which adds
4204f909564SJim Jagielski    the name for input only. The UI name is RRI in en-US and ZGZ in
4214f909564SJim Jagielski    German (translation keyed on SC_OPCODE_ZGZ).
4224f909564SJim Jagielski- The RRI commit (6fefc3f19c) had renamed ocZGZ, SC_OPCODE_ZGZ, ScZGZ()
4234f909564SJim Jagielski    and HID_FUNC_ZGZ and added the alias with putOpCode(), which also
4244f909564SJim Jagielski    replaced the name AOO writes; both were undone 2026-11-18.
4254f909564SJim Jagielski- Excel mapping: saFuncTable_Odf line 428, `_xlfnodf.RRI`.
4264f909564SJim Jagielski- Evaluator implementation: ScZGZ() at interpr2.cxx:1295.
4274f909564SJim Jagielski    Takes exactly 3 params: periods, present value, future value.
4284f909564SJim Jagielski    Computes pow(Fv/Pv, 1/N) - 1. Format: percent.
4294f909564SJim Jagielski- Help entry: HID_FUNC_ZGZ (hidother.src:136, helpids.h:528); English
4304f909564SJim Jagielski    RRI topic in 04060118.xhp.
4314f909564SJim Jagielski
4324f909564SJim JagielskiB. Actual implementation: ScZGZ() computes pow(Fv/Pv, 1/N) - 1 and
4334f909564SJim Jagielski  checks nothing; ODF requires N > 0. 8ce50c3485 reclassified the earlier
4344f909564SJim Jagielski  validation concern as a test-data error. The formula itself is right:
4354f909564SJim Jagielski  RRI(10;100;200) = 0.0717734625362931, as Excel 16.
4360224e3dcSPedro Giffuni
4370224e3dcSPedro GiffuniC. Format compatibility
4380224e3dcSPedro Giffuni
4394f909564SJim Jagielski- ODF: of:RRI written; of:ZGZ and of:RRI read (run).
4404f909564SJim Jagielski- XLS: `_xlfnodf.RRI`; AOO reads it back, Excel shows #NAME? (run).
4418501d2b6SJim Jagielski- XLSX import: `_xlfn.RRI` is read (run, 2026-11-18).
4420224e3dcSPedro Giffuni
4434f909564SJim JagielskiD. Documentation: English help (04060118.xhp, unchanged from trunk).
4440224e3dcSPedro Giffuni
4454f909564SJim JagielskiFailure type: No N > 0 check; xls/xlsx naming.
4464f909564SJim JagielskiPriority: P3.
4474f909564SJim JagielskiConfidence: HIGH — run.
4480224e3dcSPedro Giffuni
4494f909564SJim Jagielski10\. ERROR.TYPE
4504f909564SJim Jagielski--------------
4510224e3dcSPedro Giffuni
4524f909564SJim JagielskiODF 1.4: Defined (§6.13.11 in ODF 1.2 and 1.4). Not propagating; a
4534f909564SJim Jagielski  non-error gives an error; #NULL!..#N/A are 1..7.
4540224e3dcSPedro GiffuniODF group: Verify against final spec (likely Large Group).
4550224e3dcSPedro Giffuni
4560224e3dcSPedro GiffuniA. Function registration
4570224e3dcSPedro Giffuni
4584f909564SJim Jagielski- Native opcode: SC_OPCODE_ERROR_TYPE_ODF = 419 (compiler.hrc line
4594f909564SJim Jagielski    415), ocErrorTypeODF (opcode.hxx line 177), since 2026-11-18. The
4604f909564SJim Jagielski    legacy SC_OPCODE_ERROR_TYPE = 151 (line 182) stays ERRORTYPE.
4614f909564SJim Jagielski- Parser names:
4624f909564SJim Jagielski  - ERROR.TYPE: "ERROR.TYPE" in ODF, English and UI lists
4634f909564SJim Jagielski      (core_resource.src lines 147, 500, 1129)
4644f909564SJim Jagielski  - ERRORTYPE: "ORG.OPENOFFICE.ERRORTYPE" (ODF, line 146), "ERRORTYPE"
4654f909564SJim Jagielski      (English, line 499; UI, line 1125)
4664f909564SJim Jagielski- Evaluator implementation: ScErrorType( bool bODF ) at
4674f909564SJim Jagielski    interpr1.cxx:8703. Both opcodes are in CASE_OCERRFUNC
4684f909564SJim Jagielski    (interpr4.cxx:3863-3864), so an error argument reaches them.
4694f909564SJim Jagielski- Help entry: HID_FUNC_ERROR_TYPE_ODF (helpids.h:736, hidother.src:328),
4704f909564SJim Jagielski    topic func_errortype.xhp embedded in 04060109.xhp next to ERRORTYPE
4714f909564SJim Jagielski    (HID_FUNC_FEHLERTYP). H.4's topic had reused HID_FUNC_FEHLERTYP and
4724f909564SJim Jagielski    was embedded in the date functions page.
4734f909564SJim Jagielski- Excel mapping: BIFF4 ID 261 (xlformula.cxx lines 260-261): import to
4744f909564SJim Jagielski    ocErrorTypeODF, export from both. xlsx: ERROR.TYPE (formulabase.cxx
4754f909564SJim Jagielski    line 486).
4764f909564SJim Jagielski
4774f909564SJim JagielskiB. Actual implementation: ScErrorType() examines the stack type:
4784f909564SJim Jagielski
4790224e3dcSPedro Giffuni- svRefList: gets error code from first cell in ref list;
4800224e3dcSPedro Giffuni    errNoRef if empty, errNoValue if >1 ref.
4810224e3dcSPedro Giffuni- svDoubleRef/svSingleRef: gets cell error code via pDok->GetErrCode().
4820224e3dcSPedro Giffuni- default: PopError(), pushes error number.
4830224e3dcSPedro Giffuni  If no error (nErr == 0), pushes NA (PushNA()).
4844f909564SJim Jagielski  For ERROR.TYPE, lcl_ErrorTypeODF() (interpr1.cxx:8680) maps the code as
4854f909564SJim Jagielski  XclTools::GetXclErrorCode does: errNoCode 1; errDivisionByZero 2;
4864f909564SJim Jagielski  errNoValue, errIllegalArgument, errIllegalParameter, errPairExpected,
4874f909564SJim Jagielski  errOperatorExpected, errVariableExpected, errParameterExpected,
4884f909564SJim Jagielski  errCircularReference 3; errNoRef 4; errNoName, errNoAddin, errNoMacro 5;
4894f909564SJim Jagielski  errIllegalFPOperation 6; everything else 7.
4904f909564SJim Jagielski  ERROR.TYPE is in the multi-argument opcode range, so it checks for exactly
4914f909564SJim Jagielski  one argument itself (MustHaveParamCount); `=ERROR.TYPE()` is an error
4924f909564SJim Jagielski  (calcval row ERROR.TYPE.args, run).
4934f909564SJim Jagielski  H.4 had changed ScErrorType() itself, so ERRORTYPE returned 1-7 and
4944f909564SJim Jagielski  lost the internal codes its help documents (Err:518 gives 518); Jim's
4954f909564SJim Jagielski  decision: separate function, ERRORTYPE as on trunk.
4960224e3dcSPedro Giffuni
4974f909564SJim JagielskiC. Format compatibility: xls ERROR.TYPE reads as ERROR.TYPE; ERRORTYPE
4984f909564SJim Jagielski  is written as ERROR.TYPE and comes back as ERROR.TYPE (run). xlsx
4994f909564SJim Jagielski  ERROR.TYPE read (run).
5000224e3dcSPedro Giffuni
5014f909564SJim JagielskiD. Documentation: English topics for both functions.
5020224e3dcSPedro Giffuni
5034f909564SJim JagielskiFailure type: None. ERROR.TYPE(SQRT(-1)) is 3 in AOO (Err:502) and 6 in
5044f909564SJim Jagielski  Excel.
5054f909564SJim JagielskiPriority: Resolved (was P1).
5064f909564SJim JagielskiConfidence: HIGH — run, Excel 16.
5070224e3dcSPedro Giffuni
5084f909564SJim Jagielski11\. NUMBERVALUE
5090224e3dcSPedro Giffuni---------------
5100224e3dcSPedro Giffuni
5114f909564SJim JagielskiODF 1.4: Defined (§6.13.28 in ODF 1.2 and 1.4).
5120224e3dcSPedro GiffuniODF group: Verify against final spec (likely Large Group).
5130224e3dcSPedro Giffuni
5140224e3dcSPedro GiffuniA. Function registration
5154f909564SJim Jagielski
5160224e3dcSPedro Giffuni- Native opcode: SC_OPCODE_NUMBERVALUE = 392 (compiler.hrc line 388).
5174f909564SJim Jagielski- Parser name: "NUMBERVALUE" in core_resource.src lines 356 (ODF)
5184f909564SJim Jagielski    and 709 (Excel).
5190224e3dcSPedro Giffuni- Function-name-to-opcode mapping: ocNumberValue → NUMBERVALUE.
5200224e3dcSPedro Giffuni- Evaluator implementation: ScInterpreter::ScNumberValue() at
5214f909564SJim Jagielski    main/sc/source/core/tool/interpr1.cxx:3102 (moved from interpr4.cxx
5224f909564SJim Jagielski    2026-11-18). Dispatch via `case ocNumberValue : ScNumberValue();` at
5234f909564SJim Jagielski    interpr4.cxx:3558.
5244f909564SJim Jagielski- Function parameter metadata: Function Wizard resource with 3
5254f909564SJim Jagielski    parameters, 2 and 3 optional (the H.1 block had one flag too few).
5264f909564SJim Jagielski- Help entry: HID_FUNC_NUMBERVALUE (hidother.src:378, helpids.h:784);
5274f909564SJim Jagielski    topic func_numbervalue.xhp.
5284f909564SJim Jagielski- Excel mapping: saFuncTable_Odf line 424:
5294f909564SJim Jagielski      EXC_FUNCENTRY_ODF( ocNumberValue, 1, 3, 0, "NUMBERVALUE" )
5304f909564SJim Jagielski    (was 2, 2).
5310224e3dcSPedro Giffuni
5324f909564SJim JagielskiB. Actual implementation: the ODF steps in order: group separators
5334f909564SJim Jagielski  removed only before the first decimal separator, that separator turned
5344f909564SJim Jagielski  into '.', whitespace removed, trailing percent signs stripped (each
5354f909564SJim Jagielski  divides by 100), and the rest must be a plain xsd:float without INF/NaN
5364f909564SJim Jagielski  (lcl_IsPlainFloat(), interpr1.cxx:3072). LEN(DecimalSeparator) must be 1
5374f909564SJim Jagielski  and it must not occur in GroupSeparator; omitted separators come from
5384f909564SJim Jagielski  the locale, and the locale group separator is dropped when it equals
5394f909564SJim Jagielski  the given decimal separator. The H.1 version removed group separators
5404f909564SJim Jagielski  everywhere and replaced every decimal separator.
5410224e3dcSPedro Giffuni
5420224e3dcSPedro GiffuniC. Format compatibility
5430224e3dcSPedro Giffuni
5444f909564SJim Jagielski- XLS: `_xlfnodf.NUMBERVALUE`; AOO reads it back, Excel shows #NAME? (run).
5458501d2b6SJim Jagielski- XLSX import: `_xlfn.NUMBERVALUE` is read (run, 2026-11-18).
5460224e3dcSPedro Giffuni
5474f909564SJim JagielskiD. Documentation: func_numbervalue.xhp (rules added 2026-11-18).
5484f909564SJim Jagielski
5494f909564SJim JagielskiFailure type: None. Differences from Excel 16 on purpose: empty text is
5504f909564SJim Jagielski  an error (Excel 0), an empty GroupSeparator is accepted (Excel error),
5514f909564SJim Jagielski  a two-character DecimalSeparator is an error (Excel uses the first).
5520224e3dcSPedro GiffuniPriority: Resolved (was P1).
5534f909564SJim JagielskiConfidence: HIGH — run, Excel 16.
5540224e3dcSPedro Giffuni
5554f909564SJim Jagielski12\. GETPIVOTDATA
5560224e3dcSPedro Giffuni----------------
5570224e3dcSPedro Giffuni
5580224e3dcSPedro GiffuniODF 1.4: Not defined by ODF 1.4 Part 4. Excel-specific function.
5590224e3dcSPedro GiffuniODF group: Not applicable.
5600224e3dcSPedro Giffuni
5610224e3dcSPedro GiffuniA. Function registration
5624f909564SJim Jagielski
5630224e3dcSPedro Giffuni- Native opcode: SC_OPCODE_GET_PIVOT_DATA = 390 (compiler.hrc line 386).
5644f909564SJim Jagielski- Parser name: "GETPIVOTDATA" in core_resource.src lines 354 (ODF)
5654f909564SJim Jagielski    and 707 (Excel).
5660224e3dcSPedro Giffuni- Function-name-to-opcode mapping: ocGetPivotData → GETPIVOTDATA.
5674f909564SJim Jagielski- Evaluator implementation: ScGetPivotData() at interpr2.cxx:3069.
5680224e3dcSPedro Giffuni    Takes 2–30 params (must be even count). Supports old syntax
5690224e3dcSPedro Giffuni    (constraint string) and new syntax (field/item pairs). Uses
5700224e3dcSPedro Giffuni    pDok->GetDPAtBlock() to find the DataPilot object.
5710224e3dcSPedro Giffuni- Function parameter metadata: Via native function resource.
5724f909564SJim Jagielski- Help entry: HID_FUNC_GETPIVOTDATA (hidother.src:334, helpids.h:742).
5730224e3dcSPedro Giffuni- ODF formula namespace mapping: GETPIVOTDATA in both sections.
5744f909564SJim Jagielski- Excel import mapping: saFuncTable_8 line 355 (BIFF8):
5750224e3dcSPedro Giffuni      { ocGetPivotData, 358, 2, MX, V, { RR, RR, VR }, 0, 0 }
5760224e3dcSPedro Giffuni- Excel export mapping: BIFF8 export (same table entry, no importonly/exportonly flag).
5770224e3dcSPedro Giffuni
5780224e3dcSPedro GiffuniB. Actual implementation: ScGetPivotData() parses target field name
5790224e3dcSPedro Giffuni  and field/item filter pairs, locates the DataPilot table via
5800224e3dcSPedro Giffuni  ScDPObject, calls GetPivotData(). Comment at interpr2.cxx:3035–3036
5810224e3dcSPedro Giffuni  notes: "MS Excel docs claim to use the 'most recent' which is not
5824f909564SJim Jagielski  exactly the same as what we do in ScDocument::GetDPAtBlock." (not
5834f909564SJim Jagielski  re-read 2026-11-18) The
5840224e3dcSPedro Giffuni  function depends entirely on the DataPilot subsystem
5850224e3dcSPedro Giffuni  (dptablecache.cxx:517 mentions GETPIVOTDATA disabling nested
5860224e3dcSPedro Giffuni  formula interpretation).
5870224e3dcSPedro Giffuni
5880224e3dcSPedro GiffuniC. Format compatibility
5894f909564SJim Jagielski
5900224e3dcSPedro Giffuni- XLS import: BIFF8 (function ID 358), recognized and mapped.
5914f909564SJim Jagielski- XLSX import: oox/source/xls/formulabase.cxx line 692 has an
5924f909564SJim Jagielski    import-only GETPIVOTDATA row (xlsx import does not use
5934f909564SJim Jagielski    saFuncTable_Oox, which is xls-only). Not run.
5940224e3dcSPedro Giffuni- XLS export: BIFF8 export supported.
5954f909564SJim Jagielski- XLSX export: AOO has no xlsx export.
5960224e3dcSPedro Giffuni
5970224e3dcSPedro GiffuniD. Documentation: Help entry exists.
5980224e3dcSPedro Giffuni
5994f909564SJim JagielskiFailure type: Implementation present. DataPilot dependency makes it
6000224e3dcSPedro Giffuni  application-level.
6014f909564SJim JagielskiPriority: P3.
6020224e3dcSPedro GiffuniConfidence: HIGH — source evidence clear; runtime unverified.
6030224e3dcSPedro Giffuni
6044f909564SJim Jagielski13\. FDIST
6054f909564SJim Jagielski---------
6060224e3dcSPedro Giffuni
6074f909564SJim JagielskiODF 1.4: ODF FDIST (§6.18.22) is the left tail with optional Cumulative
6084f909564SJim Jagielski  (default TRUE; 0 for x < 0; density error only at x = 0, r1 = 1).
6094f909564SJim Jagielski  LEGACY.FDIST (§6.18.23) is the right tail, three arguments.
6100224e3dcSPedro GiffuniODF group: Not applicable.
6110224e3dcSPedro Giffuni
6120224e3dcSPedro GiffuniA. Function registration
6130224e3dcSPedro Giffuni
6144f909564SJim Jagielski- AOO FDIST = ODF LEGACY.FDIST: SC_OPCODE_F_DIST = 315 (compiler.hrc
6154f909564SJim Jagielski    line 311), ocFDist, ScFDist() at interpr3.cxx:1588, three arguments,
6164f909564SJim Jagielski    unchanged from trunk. Names: "LEGACY.FDIST" (ODF, core_resource.src
6174f909564SJim Jagielski    line 287), "FDIST" (English line 640, UI line 1695). xls BIFF4 281.
6184f909564SJim Jagielski    Help HID_FUNC_FVERT.
6194f909564SJim Jagielski- AOO F.DIST = ODF FDIST, since 2026-11-18: SC_OPCODE_F_DIST_LEFT = 417
6204f909564SJim Jagielski    (compiler.hrc line 413), ocFDistLeft (opcode.hxx line 372),
6214f909564SJim Jagielski    ScFDistLeft() at interpr3.cxx:1604. Names: "FDIST" (ODF, line 288),
6224f909564SJim Jagielski    "F.DIST" (English line 641, UI line 1699). xls: saFuncTable_Oox
6234f909564SJim Jagielski    lines 385-386, `_xlfn.F.DIST`; `_xlfnodf.FDIST` imports as FDIST
6244f909564SJim Jagielski    (line 421). Help HID_FUNC_F_DIST_LEFT (helpids.h:689,
6254f909564SJim Jagielski    hidother.src:285), F.DIST section in 04060182.xhp.
6260224e3dcSPedro Giffuni
6274f909564SJim JagielskiB. History: H.8/H.8.1 changed ocFDist itself into the left tail (with a
6284f909564SJim Jagielski  4th argument popped after the others) and added ocLegacyFDist. That
6294f909564SJim Jagielski  changed FDIST typed in every UI language, in macros and in .sxc files,
6304f909564SJim Jagielski  and f4f3de4f92 then dropped the SC_OPCODE_LEGACY_F_* defines, so the
6314f909564SJim Jagielski  branch did not build. Jim's decision: keep FDIST, add F.DIST.
6324f909564SJim Jagielski  ScFDistLeft() computes the left tail with GetBetaDist() at
6334f909564SJim Jagielski  r1*x/(r1*x+r2) and the density with GetBetaDistPDF().
6340224e3dcSPedro Giffuni
6354f909564SJim JagielskiC. Format compatibility
6360224e3dcSPedro Giffuni
6374f909564SJim Jagielski- ODF: of:FDIST ↔ F.DIST, of:LEGACY.FDIST ↔ FDIST (run, round trip).
6384f909564SJim Jagielski- XLS: FDIST as 281 (run); F.DIST as `_xlfn.F.DIST`, Excel calculates the 4-argument form (run); `_xlfnodf.FDIST` from an older xls reads as FDIST (run).
6398501d2b6SJim Jagielski- XLSX: FDIST (281) read (run); `_xlfn.F.DIST` is read (run, 2026-11-18).
6400224e3dcSPedro Giffuni
6414f909564SJim JagielskiD. Documentation: FDIST help as on trunk; F.DIST section added.
6420224e3dcSPedro Giffuni
6434f909564SJim JagielskiFailure type: None.
6444f909564SJim JagielskiPriority: Resolved.
6454f909564SJim JagielskiConfidence: HIGH — run; F.DIST and FDIST match Excel 16 on 300 and 263
6464f909564SJim Jagielski            random cases.
6474f909564SJim Jagielski
6484f909564SJim Jagielski14\. FINV
6494f909564SJim Jagielski--------
6504f909564SJim Jagielski
6514f909564SJim JagielskiODF 1.4: ODF FINV (§6.18.24) inverts FDIST (left tail); LEGACY.FINV
6524f909564SJim Jagielski  (§6.18.25) inverts LEGACY.FDIST.
6534f909564SJim JagielskiODF group: Not applicable.
6544f909564SJim Jagielski
6554f909564SJim JagielskiA. Function registration
6564f909564SJim Jagielski
6574f909564SJim Jagielski- AOO FINV = ODF LEGACY.FINV: SC_OPCODE_F_INV = 359 (compiler.hrc line
6584f909564SJim Jagielski    355), ScFInv() at interpr3.cxx:2052, unchanged. Names "LEGACY.FINV"
6594f909564SJim Jagielski    (ODF, line 332), "FINV" (English line 685, UI line 1879). xls BIFF4
6604f909564SJim Jagielski    282.
6614f909564SJim Jagielski- AOO F.INV = ODF FINV, since 2026-11-18: SC_OPCODE_F_INV_LEFT = 418
6624f909564SJim Jagielski    (compiler.hrc line 414), ocFInvLeft, ScFInvLeft() at
6634f909564SJim Jagielski    interpr3.cxx:2074, using ScFDistLeftFunction + lcl_IterateInverse.
6644f909564SJim Jagielski    Names "FINV" (ODF, line 333), "F.INV" (English line 686, UI line
6654f909564SJim Jagielski    1883). xls `_xlfnodf.FINV` (saFuncTable_Odf line 417). Help
6664f909564SJim Jagielski    HID_FUNC_F_INV_LEFT, F.INV section in 04060182.xhp.
6674f909564SJim Jagielski
6684f909564SJim JagielskiB. Actual implementation: F.INV accepts 0 <= p < 1 (0 gives 0).
6694f909564SJim Jagielski
6704f909564SJim JagielskiC. Format compatibility: as FDIST/F.DIST.
6714f909564SJim Jagielski
6724f909564SJim JagielskiD. Documentation: FINV help as on trunk; F.INV section added.
6734f909564SJim Jagielski
6744f909564SJim JagielskiFailure type: None.
6754f909564SJim JagielskiPriority: Resolved.
6764f909564SJim JagielskiConfidence: HIGH — run; FINV matches Excel 16 on 300 random cases, F.INV
6774f909564SJim Jagielski            on 298 (the other two within 3e-10 at p = 0.999, r2 = 1).
6784f909564SJim Jagielski
6794f909564SJim Jagielski15\. HARMEAN
6804f909564SJim Jagielski-----------
6810224e3dcSPedro Giffuni
6820224e3dcSPedro GiffuniODF 1.4: Defined by ODF 1.4 Part 4 (statistical function).
6830224e3dcSPedro GiffuniODF group: Verify against final spec (likely Large Group).
6840224e3dcSPedro Giffuni
6850224e3dcSPedro GiffuniA. Function registration
6864f909564SJim Jagielski
6870224e3dcSPedro Giffuni- Native opcode: SC_OPCODE_HAR_MEAN = 321 (compiler.hrc line 317).
6884f909564SJim Jagielski- Parser name: "HARMEAN" in core_resource.src lines 294 (ODF)
6894f909564SJim Jagielski    and 647 (Excel).
6904f909564SJim Jagielski- Function-name-to-opcode mapping: ocHarMean → HARMEAN.
6914f909564SJim Jagielski- Evaluator implementation: ScHarMean() at interpr3.cxx:2637.
6920224e3dcSPedro Giffuni    Iterates over params, accumulates 1/x for x>0, counts values.
6930224e3dcSPedro Giffuni    Sets errIllegalArgument for x<=0. Skips empty cells.
6940224e3dcSPedro Giffuni- Function parameter metadata: Via native function resource.
6954f909564SJim Jagielski- Help entry: HID_FUNC_HARMITTEL (hidother.src:248, helpids.h:652).
6964f909564SJim Jagielski    The help ID name is German; the help text (04060182.xhp) is English.
6970224e3dcSPedro Giffuni- ODF formula namespace mapping: HARMEAN in both sections.
6984f909564SJim Jagielski- Excel import/export mapping: BIFF4 ID 320 both ways
6994f909564SJim Jagielski    (xlformula.cxx line 313, saFuncTable_4); xlsx 320
7004f909564SJim Jagielski    (formulabase.cxx line 538).
7010224e3dcSPedro Giffuni
7020224e3dcSPedro GiffuniB. Actual implementation: ScHarMean() implements H = n / Σ(1/xᵢ)
7030224e3dcSPedro Giffuni  counting only positive values. Zero or negative values trigger
7040224e3dcSPedro Giffuni  errIllegalArgument. Text values and empty cells are skipped
7050224e3dcSPedro Giffuni  (handled by the switch's default case / HasCellValueData check).
7060224e3dcSPedro Giffuni  Error values propagate via nGlobalError.
7070224e3dcSPedro Giffuni
7084f909564SJim JagielskiC. Format compatibility: BIFF 320 and xlsx (source; not run).
7090224e3dcSPedro Giffuni
7104f909564SJim JagielskiD. Documentation: English help in 04060182.xhp.
7110224e3dcSPedro Giffuni
7124f909564SJim JagielskiFailure type: None found.
7134f909564SJim JagielskiPriority: P3.
7144f909564SJim JagielskiConfidence: HIGH — source.
7150224e3dcSPedro Giffuni
7160224e3dcSPedro GiffuniCross-Cutting Observation: LENB/RIGHTB/LEFTB/MIDB Opcodes
7170224e3dcSPedro Giffuni----------------------------------------------------------
7180224e3dcSPedro Giffuni
7190224e3dcSPedro Giffunicompiler.hrc defines SC_OPCODE_LENB=400, SC_OPCODE_RIGHTB=401,
7204f909564SJim JagielskiSC_OPCODE_LEFTB=402, SC_OPCODE_MIDB=403, and since H.2
7214f909564SJim JagielskiSC_OPCODE_FINDB=412, SC_OPCODE_SEARCHB=413, SC_OPCODE_REPLACEB=414.
7224f909564SJim JagielskiAll seven map to Excel's BIFF IDs 205-211.
723