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 481a24d88bd886c1483c62cf93c0362f01ac9b74 Author: Jim Jagielski <[email protected]> AuthorDate: Wed Nov 18 09:16:26 2026 -0500 test/odf-validate: replace the post-#523 calcval cases with ones checked against Excel Again, we're using Excel (and our interpretation of the docs) to determine "correctness" --- test/odf-validate/calcval-cases14.tsv | 287 ++++++++++++---------------------- test/odf-validate/calcval.py | 3 +- 2 files changed, 105 insertions(+), 185 deletions(-) diff --git a/test/odf-validate/calcval-cases14.tsv b/test/odf-validate/calcval-cases14.tsv index 2429a4579e..f30b899c1f 100644 --- a/test/odf-validate/calcval-cases14.tsv +++ b/test/odf-validate/calcval-cases14.tsv @@ -2,7 +2,7 @@ # formula: AOO API syntax (English function names, ';' separators, '|' row separator in inline arrays), leading '='. # mode: cell | cell@N (plain cell, scratch cell AA<N>; default AA1) | array[:CxR] (setArrayFormula on AA1 sized C columns x R rows; default 1x1). # expected: '-' = record only; number (relative tolerance 1e-9; '~' prefix = 1e-6); '#N/A'; '#ERR' (any error); 's:text'; for array modes a '|' separated row-major list of those. -# RECEIVED, BESSELK, BESSELY, CONVERT are Analysis add-in functions: calcval.py rewrites them to their programmatic names. +# RECEIVED, BESSELK, BESSELY, CONVERT, ODDFPRICE, ODDFYIELD are Analysis add-in functions: calcval.py rewrites them to their programmatic names. # Expected values come from the public ODF 1.4 Part 4 text (OpenDocument-v1.4-os-part4-formula). # # Data written by calcval.py on sheet 1 (second sheet is named Other): @@ -92,32 +92,6 @@ CONVERT.Pa.Torr =CONVERT(133.32236842105263;"Pa";"Torr") cell 1 6.16.18 Table 24 CONVERT.atm.Torr =CONVERT(1;"atm";"Torr") cell 760.0007500616828 6.16.18 Table 24: atm to Torr cross-conversion CONVERT.SI_at.atm =CONVERT(1;"SI_at";"atm") cell 0.9678401501700961 6.16.18 Table 24: SI_at to atm cross-conversion CONVERT.Torr.SI_at =CONVERT(1;"Torr";"SI_at") cell 0.001359509806315639 6.16.18 Table 24: Torr to SI_at cross-conversion -NUMBERVALUE.basic =NUMBERVALUE("1.234";".";",") cell 1.234 6.13.28 basic decimal conversion -NUMBERVALUE.european =NUMBERVALUE("1.234,56";",";".") cell 1234.56 6.13.28 European decimal/comma separators -NUMBERVALUE.space.group =NUMBERVALUE("1 234.56";".";" ") cell 1234.56 6.13.28 space group separator -NUMBERVALUE.empty =NUMBERVALUE("";".";",") cell #ERR 6.13.28 empty text is an error -NUMBERVALUE.whitespace =NUMBERVALUE(" 123 ";".";",") cell 123 6.13.28 whitespace removed before conversion -NUMBERVALUE.percent =NUMBERVALUE("123%";".";",") cell 1.23 6.13.28 trailing percent divides by 100 -NUMBERVALUE.double.percent =NUMBERVALUE("10%%";".";",") cell 0.001 6.13.28 two percent signs divide by 10000 -NUMBERVALUE.decimal.percent =NUMBERVALUE(".5%";".";",") cell 0.005 6.13.28 decimal value with percent sign -NUMBERVALUE.repeated.decimal =NUMBERVALUE("1.2.3";".";",") cell #ERR 6.13.28 repeated decimal separator is an error -NUMBERVALUE.negative =NUMBERVALUE("-123.45";".";",") cell -123.45 6.13.28 negative number -NUMBERVALUE.scientific =NUMBERVALUE("1.5e2";".";",") cell 150 6.13.28 scientific notation -NUMBERVALUE.omitted.seps =NUMBERVALUE("123") cell 123 6.13.28 omitted separators use locale defaults -FINDB.basic =FINDB("b";"abc") cell 2 6.7.x case-sensitive byte search -FINDB.case =FINDB("B";"abc") cell #ERR 6.7.x case-sensitive: uppercase not found -FINDB.start =FINDB("b";"abc";2) cell 2 6.7.x start at byte position 2 -FINDB.notfound =FINDB("x";"abc") cell #ERR 6.7.x not found returns error -FINDB.empty =FINDB("";"abc") cell 1 6.7.x empty find text returns 1 -SEARCHB.basic =SEARCHB("b";"abc") cell 2 6.7.x case-insensitive byte search -SEARCHB.case =SEARCHB("B";"abc") cell 2 6.7.x case-insensitive: finds lowercase -SEARCHB.upper =SEARCHB("b";"ABC") cell 1 6.7.x case-insensitive: finds uppercase -SEARCHB.start =SEARCHB("b";"abc";2) cell 2 6.7.x start at byte position 2 -REPLACEB.basic =REPLACEB("abc";2;1;"X") cell aXc 6.7.x replace 1 byte at position 2 -REPLACEB.start1 =REPLACEB("abc";1;2;"XY") cell XYc 6.7.x replace 2 bytes at position 1 -REPLACEB.append =REPLACEB("abc";4;1;"X") cell abcX 6.7.x start beyond length appends -REPLACEB.truncate =REPLACEB("abc";2;10;"X") cell aX 6.7.x count exceeds remaining truncates -REPLACEB.zero =REPLACEB("abc";2;0;"X") cell aXbc 6.7.x zero count inserts EASTER.mid =EASTERSUNDAY(1000) cell #ERR 6.10.8 constraint 1583 <= Year (100 to 1582) EASTER.neg =EASTERSUNDAY(-1) cell #ERR 6.10.8 constraint 1583 <= Year (negative years used to wrap) EASTER.wrap =EASTERSUNDAY(67536) cell #ERR 6.10.8 constraint Year <= 9956 (67536 used to wrap to 2000) @@ -299,160 +273,105 @@ SG.CONV-003-ref =N(D1) cell 10 6.13.26 N dereferences a Reference to a scalar (D SG.CONV-004-logical =N(TRUE()) cell 1 6.13.26 N of TRUE is 1 SG.CONV-004-logical2 =IF(0;TRUE();FALSE()) cell 0 6.3.12 the Number 0 converts to FALSE SG.CONV-005-error =ISERR(1/0) cell 1 6.13.15 ISERR of a division by zero (TRUE) -SG.DATEDIF-001-d-days =DATEDIF(DATE(2024;1;1);DATE(2024;12;31);"d") cell 365 6.10.3 days between Jan 1 and Dec 31 in leap year -SG.DATEDIF-002-m-months =DATEDIF(DATE(2024;1;1);DATE(2025;1;1);"m") cell 12 6.10.3 complete months between same day consecutive years -SG.DATEDIF-003-y-years =DATEDIF(DATE(2024;1;1);DATE(2025;1;1);"y") cell 1 6.10.3 complete years between same day consecutive years -SG.DATEDIF-004-same-date =DATEDIF(DATE(2024;1;1);DATE(2024;1;1);"d") cell 0 6.10.3 zero interval returns 0 -SG.DATEDIF-005-m-jan-feb =DATEDIF(DATE(2024;1;1);DATE(2024;2;1);"m") cell 1 6.10.3 one complete month Jan to Feb -SG.DATEDIF-006-d-jan-feb29 =DATEDIF(DATE(2024;1;1);DATE(2024;2;29);"d") cell 59 6.10.3 days from Jan 1 to Feb 29 in leap year -SG.DATEDIF-007-d-feb29-mar1 =DATEDIF(DATE(2024;2;29);DATE(2024;3;1);"d") cell 1 6.10.3 one day from Feb 29 to Mar 1 in leap year -SG.DATEDIF-008-m-jan-jun =DATEDIF(DATE(2024;1;1);DATE(2024;6;1);"m") cell 5 6.10.3 five complete months Jan to Jun -SG.DATEDIF-009-d-jan-jun =DATEDIF(DATE(2024;1;1);DATE(2024;6;1);"d") cell 152 6.10.3 days from Jan 1 to Jun 1 in leap year -SG.DATEDIF-010-md =DATEDIF(DATE(2024;1;15);DATE(2024;3;10);"md") cell 26 6.10.3 days ignoring months/years with borrow from start month (10+31-15) -SG.DATEDIF-011-ym =DATEDIF(DATE(2024;1;15);DATE(2024;3;10);"ym") cell 1 6.10.3 months ignoring years after complete months (1m 26d) -SG.DATEDIF-012-yd =DATEDIF(DATE(2024;1;15);DATE(2024;3;10);"yd") cell 55 6.10.3 days ignoring years from anniversary to end date -SG.DATEDIF-013-reverse-d =DATEDIF(DATE(2024;12;31);DATE(2024;1;1);"d") cell -365 6.10.3 reverse date negates forward y/m/d result -SG.DATEDIF-014-invalid-format =DATEDIF(DATE(2024;1;1);DATE(2024;12;31);"x") cell #ERR 6.10.3 invalid format string is an error -SG.DATEDIF-015-empty-format =DATEDIF(DATE(2024;1;1);DATE(2024;12;31);"") cell #ERR 6.10.3 empty format string is an error -SG.DATEDIF-016-same-m =DATEDIF(DATE(2024;1;1);DATE(2024;1;1);"m") cell 0 6.10.3 zero interval months -SG.DATEDIF-017-same-y =DATEDIF(DATE(2024;1;1);DATE(2024;1;1);"y") cell 0 6.10.3 zero interval years -SG.DATEDIF-018-same-md =DATEDIF(DATE(2024;1;1);DATE(2024;1;1);"md") cell 0 6.10.3 zero interval md -SG.DATEDIF-019-same-ym =DATEDIF(DATE(2024;1;1);DATE(2024;1;1);"ym") cell 0 6.10.3 zero interval ym -SG.DATEDIF-020-same-yd =DATEDIF(DATE(2024;1;1);DATE(2024;1;1);"yd") cell 0 6.10.3 zero interval yd -SG.DATEDIF-021-y-incomplete =DATEDIF(DATE(2024;3;1);DATE(2025;2;28);"y") cell 0 6.10.3 incomplete year not counted -SG.DATEDIF-022-y-leap-anniv =DATEDIF(DATE(2024;2;29);DATE(2025;2;28);"y") cell 0 6.10.3 leap-day anniversary not reached on Feb 28 non-leap year -SG.DATEDIF-023-y-leap-to-leap =DATEDIF(DATE(2020;2;29);DATE(2024;2;29);"y") cell 4 6.10.3 four complete years including leap cycle -SG.DATEDIF-024-m-end-of-month =DATEDIF(DATE(2024;1;31);DATE(2024;2;29);"m") cell 1 6.10.3 end-of-month substitution counts full month -SG.DATEDIF-025-m-partial-day =DATEDIF(DATE(2024;1;31);DATE(2024;3;30);"m") cell 1 6.10.3 incomplete month when end day before start day -SG.DATEDIF-026-m-eom-to-eom =DATEDIF(DATE(2024;1;31);DATE(2024;3;31);"m") cell 2 6.10.3 end-of-month to end-of-month complete months -SG.DATEDIF-027-d-nonleap-year =DATEDIF(DATE(2023;1;1);DATE(2023;12;31);"d") cell 364 6.10.3 days in non-leap year span -SG.DATEDIF-028-md-no-borrow =DATEDIF(DATE(2024;1;10);DATE(2024;3;15);"md") cell 5 6.10.3 days ignoring months/years without borrow -SG.DATEDIF-029-ym-no-borrow =DATEDIF(DATE(2024;1;10);DATE(2024;3;15);"ym") cell 2 6.10.3 months ignoring years without day borrow -SG.DATEDIF-030-yd-across-year =DATEDIF(DATE(2023;12;15);DATE(2024;1;10);"yd") cell 26 6.10.3 days ignoring years across year boundary -SG.DATEDIF-031-yd-same-year =DATEDIF(DATE(2024;1;1);DATE(2024;7;1);"yd") cell 182 6.10.3 days ignoring years within same year -SG.DATEDIF-032-reverse-m =DATEDIF(DATE(2025;1;1);DATE(2024;1;1);"m") cell -12 6.10.3 reverse interval negates complete months -SG.DATEDIF-033-reverse-y =DATEDIF(DATE(2025;1;1);DATE(2024;1;1);"y") cell -1 6.10.3 reverse interval negates complete years -SG.DATEDIF-034-reverse-md =DATEDIF(DATE(2024;3;10);DATE(2024;1;15);"md") cell 26 6.10.3 reverse md component is absolute -SG.DATEDIF-035-reverse-ym =DATEDIF(DATE(2024;3;10);DATE(2024;1;15);"ym") cell 1 6.10.3 reverse ym component is absolute -SG.DATEDIF-036-reverse-yd =DATEDIF(DATE(2024;3;10);DATE(2024;1;15);"yd") cell 55 6.10.3 reverse yd component is absolute -SG.DATEDIF-037-time-fraction =DATEDIF(DATE(2024;1;1)+0.75;DATE(2024;1;2)+0.25;"d") cell 1 6.10.3 time fractions are floored to calendar dates -SG.DATEDIF-038-multi-year =DATEDIF(DATE(2020;6;15);DATE(2024;8;20);"y") cell 4 6.10.3 complete years over multi-year span -SG.DATEDIF-039-multi-year-m =DATEDIF(DATE(2020;6;15);DATE(2024;8;20);"m") cell 50 6.10.3 complete months over multi-year span -SG.DATEDIF-040-multi-year-ym =DATEDIF(DATE(2020;6;15);DATE(2024;8;20);"ym") cell 2 6.10.3 months ignoring years over multi-year span -SG.DATEDIF-041-case-format =DATEDIF(DATE(2024;1;1);DATE(2024;12;31);"D") cell #ERR 6.10.3 format string is case-sensitive -SG.ERRTYPE-01-div0 =ERROR.TYPE(1/0) cell 2 6.13.x ERROR.TYPE of #DIV/0! -SG.ERRTYPE-02-value =ERROR.TYPE(#VALUE!) cell 3 6.13.x ERROR.TYPE of #VALUE! -SG.ERRTYPE-03-ref =ERROR.TYPE(#REF!) cell 4 6.13.x ERROR.TYPE of #REF! -SG.ERRTYPE-04-name =ERROR.TYPE(#NAME?) cell 5 6.13.x ERROR.TYPE of #NAME? -SG.ERRTYPE-05-num =ERROR.TYPE(#NUM!) cell 6 6.13.x ERROR.TYPE of #NUM! -SG.ERRTYPE-06-na =ERROR.TYPE(#N/A) cell 7 6.13.x ERROR.TYPE of #N/A -SG.ERRTYPE-07-null =ERROR.TYPE(IF(FALSE();A1;B1)) cell 1 6.13.x ERROR.TYPE of #NULL! (empty intersection) -SG.ERRTYPE-08-no-error =ERROR.TYPE(5) cell #N/A 6.13.x ERROR.TYPE of non-error returns #N/A -SG.ERRTYPE-09-ref-error =ERROR.TYPE(A1) cell 2 6.13.x ERROR.TYPE of cell with #DIV/0! (needs A1=1/0 setup) -SG.ERRTYPE-10-multi-ref =ERROR.TYPE(A1:B2) cell #N/A 6.13.x ERROR.TYPE of multi-ref returns #N/A (not error value) -SG.ERRTYPE-11-wrong-args =ERROR.TYPE() cell #ERR 6.13.x ERROR.TYPE wrong arg count -SG.ERRTYPE-12-odf-name =ERROR.TYPE(ORG.OPENOFFICE.ERRORTYPE(1/0)) cell 2 6.13.x ERROR.TYPE with ODF namespace name -SG.ISO-01-jan1-mon =ISOWEEKNUM(DATE(2024;1;1)) cell 1 ISO 8601 week 1 (Monday Jan 1 2024) -SG.ISO-02-jan1-tue =ISOWEEKNUM(DATE(2025;1;1)) cell 1 ISO 8601 week 1 (Wednesday Jan 1 2025 -> week 1) -SG.ISO-03-jan4-thu =ISOWEEKNUM(DATE(2024;1;4)) cell 1 ISO 8601 week 1 contains first Thursday -SG.ISO-04-dec29 =ISOWEEKNUM(DATE(2024;12;29)) cell 1 ISO 8601 week 1 of 2025 (Sunday Dec 29 2024) -SG.ISO-05-dec30 =ISOWEEKNUM(DATE(2024;12;30)) cell 1 ISO 8601 week 1 of 2025 (Monday Dec 30 2024) -SG.ISO-06-dec31 =ISOWEEKNUM(DATE(2024;12;31)) cell 1 ISO 8601 week 1 of 2025 (Tuesday Dec 31 2024) -SG.ISO-07-jan1-prev =ISOWEEKNUM(DATE(2025;1;1)) cell 1 ISO 8601 week 1 (Wednesday Jan 1 2025) -SG.ISO-08-week53 =ISOWEEKNUM(DATE(2020;12;31)) cell 53 ISO 8601 week 53 (2020 has 53 weeks) -SG.ISO-09-week52 =ISOWEEKNUM(DATE(2021;12;31)) cell 52 ISO 8601 week 52 (2021 has 52 weeks) -SG.ISO-10-week53-2015 =ISOWEEKNUM(DATE(2015;12;31)) cell 53 ISO 8601 week 53 (2015 has 53 weeks) -SG.ISO-11-leap-feb28 =ISOWEEKNUM(DATE(2024;2;28)) cell 9 ISO 8601 week 9 (Feb 28 2024) -SG.ISO-12-leap-feb29 =ISOWEEKNUM(DATE(2024;2;29)) cell 9 ISO 8601 week 9 (Feb 29 2024) -SG.ISO-13-leap-mar1 =ISOWEEKNUM(DATE(2024;3;1)) cell 9 ISO 8601 week 9 (Mar 1 2024) -SG.ISO-14-century-2000 =ISOWEEKNUM(DATE(2000;1;1)) cell 52 ISO 8601 week 52 (Jan 1 2000 was Saturday) -SG.ISO-15-century-2100 =ISOWEEKNUM(DATE(2100;1;1)) cell 52 ISO 8601 week 52 (Jan 1 2100) -SG.ISO-16-sun-mon =ISOWEEKNUM(DATE(2024;6;16)) cell 25 ISO 8601 week 25 (Sunday) -SG.ISO-17-sun-mon2 =ISOWEEKNUM(DATE(2024;6;17)) cell 25 ISO 8601 week 25 (Monday) -SG.ISO-18-time-frac =ISOWEEKNUM(DATE(2024;6;15)+0.5) cell 24 ISO 8601 week 24 (time fraction ignored) -SG.ISO-19-invalid =ISOWEEKNUM("not a date") cell #ERR ISO 8601 invalid date error -SG.ISO-20-wrong-args =ISOWEEKNUM() cell #ERR ISO 8601 wrong arg count -SG.ISO-21-jun15-2024 =ISOWEEKNUM(DATE(2024;6;15)) cell 24 ISO 8601 week 24 (mid-year) -SG.ISO-22-dec28-2020 =ISOWEEKNUM(DATE(2020;12;28)) cell 53 ISO 8601 week 53 (Monday Dec 28 2020) -SG.ISO-23-jan1-2026 =ISOWEEKNUM(DATE(2026;1;1)) cell 53 ISO 8601 week 53 of 2025 (Thursday Jan 1 2026) -SG.ISO-24-jan4-2023 =ISOWEEKNUM(DATE(2023;1;4)) cell 1 ISO 8601 week 1 (first Thursday) -SG.ISO-25-dec28-2023 =ISOWEEKNUM(DATE(2023;12;28)) cell 52 ISO 8601 week 52 (Thursday Dec 28 2023) -SG.NUMVAL-01-basic =NUMBERVALUE("1.234") cell 1.234 6.13.28 basic decimal parsing -SG.NUMVAL-02-european =NUMBERVALUE("1.234,56";",";".") cell 1234.56 6.13.28 European format with comma decimal -SG.NUMVAL-03-group-sep =NUMBERVALUE("1 234.56";".";" ") cell 1234.56 6.13.28 space group separator -SG.NUMVAL-04-percent =NUMBERVALUE("123%") cell 1.23 6.13.28 single percent divides by 100 -SG.NUMVAL-05-multi-percent =NUMBERVALUE("100%%") cell 0.01 6.13.28 double percent divides by 10000 -SG.NUMVAL-06-whitespace =NUMBERVALUE(" 123 ") cell 123 6.13.28 leading/trailing whitespace removed -SG.NUMVAL-07-empty =NUMBERVALUE("") cell #ERR 6.13.28 empty string is error -SG.NUMVAL-08-invalid-decimal =NUMBERVALUE("1.2.3") cell #ERR 6.13.28 multiple decimal separators error -SG.NUMVAL-09-locale-default =NUMBERVALUE("1234,56") cell 1234.56 6.13.28 locale default decimal comma (if locale uses comma) -SG.NUMVAL-10-cell-ref =NUMBERVALUE(N(D1)) cell 123 6.13.28 reference dereference (D1=123) -SG.FINDB-01-basic =FINDB("b";"abc") cell 2 FINDB basic find byte position -SG.FINDB-02-start-pos =FINDB("b";"abc";2) cell 2 FINDB start position -SG.FINDB-03-not-found =FINDB("x";"abc") cell #VALUE! FINDB not found returns #VALUE! -SG.FINDB-04-case-sensitive =FINDB("B";"abc") cell #VALUE! FINDB case sensitive -SG.FINDB-05-start-lt-1 =FINDB("a";"abc";0) cell #VALUE! FINDB start < 1 error -SG.FINDB-06-start-gt-len =FINDB("a";"abc";10) cell #VALUE! FINDB start > length error -SG.FINDB-07-dbcs =FINDB("中";"中国") cell 1 FINDB DBCS first char 2 bytes -SG.FINDB-08-dbcs-second =FINDB("国";"中国") cell 3 FINDB DBCS second char at byte 3 -SG.FINDB-09-mixed =FINDB("b";"a中b") cell 4 FINDB mixed ASCII/DBCS byte count -SG.FINDB-10-dbcs-start =FINDB("国";"中国";3) cell 3 FINDB start at DBCS boundary -SG.SEARCHB-01-basic =SEARCHB("b";"abc") cell 2 SEARCHB basic search byte position -SG.SEARCHB-02-case-insensitive =SEARCHB("B";"abc") cell 2 SEARCHB case insensitive -SG.SEARCHB-03-wildcard =SEARCHB("a?c";"abc") cell 1 SEARCHB wildcard ? single char -SG.SEARCHB-04-wildcard-star =SEARCHB("a*c";"abc") cell 1 SEARCHB wildcard * sequence -SG.SEARCHB-05-start-pos =SEARCHB("b";"abc";2) cell 2 SEARCHB start position -SG.SEARCHB-06-not-found =SEARCHB("x";"abc") cell #VALUE! SEARCHB not found -SG.SEARCHB-07-dbcs =SEARCHB("中";"中国") cell 1 SEARCHB DBCS first char -SG.SEARCHB-08-dbcs-second =SEARCHB("国";"中国") cell 3 SEARCHB DBCS second char -SG.SEARCHB-09-mixed =SEARCHB("b";"a中b") cell 4 SEARCHB mixed ASCII/DBCS -SG.SEARCHB-10-regex =SEARCHB("a.c";"abc") cell 1 SEARCHB regex dot matches any -SG.REPLACEB-01-basic =REPLACEB("abc";2;1;"x") cell axc REPLACEB basic replace 1 byte -SG.REPLACEB-02-append =REPLACEB("abc";4;0;"d") cell abcd REPLACEB append at end -SG.REPLACEB-03-multi-byte =REPLACEB("abcdef";2;2;"xy") cell axydef REPLACEB replace multiple bytes -SG.REPLACEB-04-dbcs =REPLACEB("中国";1;2;"中") cell 中国 REPLACEB DBCS replace first char -SG.REPLACEB-05-start-lt-1 =REPLACEB("abc";0;1;"x") cell #VALUE! REPLACEB start < 1 error -SG.REPLACEB-06-count-negative =REPLACEB("abc";2;-1;"x") cell #VALUE! REPLACEB negative count error -SG.REPLACEB-07-start-gt-len =REPLACEB("abc";10;1;"x") cell abcx REPLACEB start > len clamps to append -SG.REPLACEB-08-dbcs-boundary =REPLACEB("中国";3;2;"国") cell 中国 REPLACEB DBCS boundary replace -SG.REPLACEB-09-replace-all =REPLACEB("abc";1;3;"xyz") cell xyz REPLACEB replace entire string -SG.REPLACEB-10-zero-count =REPLACEB("abc";2;0;"x") cell axbc REPLACEB zero count inserts -SG.FDIST-01-basic =FDIST(2.5;5;10) cell 0.082 FDIST right-tailed probability -SG.FDIST-02-density =FDIST(2.5;5;10;FALSE) cell 0.078 FDIST probability density -SG.FDIST-03-cumulative-true =FDIST(2.5;5;10;TRUE) cell 0.082 FDIST cumulative (explicit TRUE) -SG.FDIST-04-integer-df =FDIST(1.5;3;8) cell 0.137 FDIST integer degrees of freedom -SG.FDIST-05-leftover =FDIST(0;1;1) cell 1 FDIST x=0 returns 1 -SG.FDIST-06-error-x-neg =FDIST(-1;5;10) cell #VALUE! FDIST negative x error -SG.FDIST-07-error-df1-zero =FDIST(2.5;0;10) cell #VALUE! FDIST df1 < 1 error -SG.FDIST-08-error-df2-zero =FDIST(2.5;5;0) cell #VALUE! FDIST df2 < 1 error -SG.FDIST-09-error-df1-large =FDIST(2.5;1e10;10) cell #VALUE! FDIST df1 >= 1e10 error -SG.FDIST-10-error-df2-large =FDIST(2.5;5;1e10) cell #VALUE! FDIST df2 >= 1e10 error -SG.FDIST-11-error-wrong-args =FDIST(2.5;5) cell #ERR FDIST wrong arg count -SG.FINV-01-basic =FINV(0.082;5;10) cell 2.5 FINV inverse of FDIST(2.5;5;10) -SG.FINV-02-roundtrip =FINV(FDIST(2.5;5;10);5;10) cell 2.5 FINV(FDIST(x)) = x -SG.FINV-03-prob-one =FINV(1;5;10) cell 0 FINV prob=1 returns 0 -SG.FINV-04-prob-small =FINV(0.001;5;10) cell 6.21 FINV small probability -SG.FINV-05-error-prob-zero =FINV(0;5;10) cell #VALUE! FINV prob <= 0 error -SG.FINV-06-error-prob-gt-one =FINV(1.1;5;10) cell #VALUE! FINV prob > 1 error -SG.FINV-07-error-df1-zero =FINV(0.5;0;10) cell #VALUE! FINV df1 < 1 error -SG.FINV-08-error-df2-zero =FINV(0.5;5;0) cell #VALUE! FINV df2 < 1 error -SG.FINV-09-error-df1-large =FINV(0.5;1e10;10) cell #VALUE! FINV df1 >= 1e10 error -SG.FINV-10-error-df2-large =FINV(0.5;5;1e10) cell #VALUE! FINV df2 >= 1e10 error -SG.FINV-11-error-wrong-args =FINV(0.5;5) cell #ERR FINV wrong arg count -SG.FDIST-12-legacy-name =LEGACY.FDIST(2.5;5;10) cell 0.082 LEGACY.FDIST name works -SG.FINV-12-legacy-name =LEGACY.FINV(0.082;5;10) cell 2.5 LEGACY.FINV name works -SG.HYPGEOM-01-pmf =HYPGEOMDIST(2;2;90;100;FALSE()) cell 0.81 HYPGEOMDIST PMF (explicit FALSE) -SG.HYPGEOM-02-cdf =HYPGEOMDIST(2;2;90;100;TRUE()) cell 0.81 HYPGEOMDIST CDF (explicit TRUE) -SG.HYPGEOM-03-legacy =HYPGEOMDIST(2;2;90;100) cell 0.81 HYPGEOMDIST legacy 4-arg returns PMF (backward compat) -SG.HYPGEOM-04-pmf-small =HYPGEOMDIST(1;4;4;10;FALSE()) cell 0.380952381 HYPGEOMDIST PMF sample -SG.HYPGEOM-05-cdf-small =HYPGEOMDIST(1;4;4;10;TRUE()) cell 0.714285714 HYPGEOMDIST CDF sample -SG.HYPGEOM-06-cdf-x0 =HYPGEOMDIST(0;5;10;20;TRUE()) cell 0.162 HYPGEOMDIST CDF at x=0 -SG.HYPGEOM-07-pmf-x0 =HYPGEOMDIST(0;5;10;20;FALSE()) cell 0.162 HYPGEOMDIST PMF at x=0 -SG.HYPGEOM-08-error-x-neg =HYPGEOMDIST(-1;5;10;20) cell #VALUE! HYPGEOMDIST x < 0 error -SG.HYPGEOM-09-error-x-gt-n =HYPGEOMDIST(6;5;10;20) cell #VALUE! HYPGEOMDIST x > n error -SG.HYPGEOM-10-error-x-gt-M =HYPGEOMDIST(11;5;10;20) cell #VALUE! HYPGEOMDIST x > M error -SG.HYPGEOM-11-error-n-gt-N =HYPGEOMDIST(5;11;10;20) cell #VALUE! HYPGEOMDIST n > N error -SG.HYPGEOM-12-error-M-gt-N =HYPGEOMDIST(5;5;21;20) cell #VALUE! HYPGEOMDIST M > N error -SG.HYPGEOM-13-error-x-lt-n-N-M =HYPGEOMDIST(0;10;5;10) cell #VALUE! HYPGEOMDIST x < n-N+M error -SG.HYPGEOM-14-wrong-args =HYPGEOMDIST(2;2;90) cell #ERR HYPGEOMDIST wrong arg count -SG.HYPGEOM-15-legacy-name =LEGACY.HYPGEOMDIST(2;2;90;100) cell 0.81 LEGACY.HYPGEOMDIST name works +# Functions added or changed on the openformula branch after PR #523 (values checked against Excel 16 where Excel has the function). +NUMBERVALUE.basic =NUMBERVALUE("1.234";".";",") cell 1.234 6.13.28 decimal separator +NUMBERVALUE.comma =NUMBERVALUE("1.234,56";",";".") cell 1234.56 6.13.28 comma decimal, period groups +NUMBERVALUE.space.group =NUMBERVALUE("1 234.56";".";" ") cell 1234.56 6.13.28 space as group separator +NUMBERVALUE.group.after.decimal =NUMBERVALUE("1.234,5";".";",") cell #ERR 6.13.28 group separators are removed only before the decimal separator +NUMBERVALUE.whitespace =NUMBERVALUE(" 1 2 3 ";".";",") cell 123 6.13.28 whitespace removed +NUMBERVALUE.percent =NUMBERVALUE("12%";".";",") cell 0.12 6.13.28 trailing percent divides by 100 +NUMBERVALUE.percent2 =NUMBERVALUE("1.5%%";".";",") cell 0.00015 6.13.28 each percent sign divides by 100 +NUMBERVALUE.leading.point =NUMBERVALUE(".5";".";",") cell 0.5 6.13.28 leading decimal separator +NUMBERVALUE.exponent =NUMBERVALUE("-1.5e3";".";",") cell -1500 6.13.28 xsd:float exponent +NUMBERVALUE.bad.exponent =NUMBERVALUE("1e";".";",") cell #ERR 6.13.28 not an xsd:float +NUMBERVALUE.two.decimals =NUMBERVALUE("1.2.3";".";",") cell #ERR 6.13.28 second decimal separator stays and is invalid +NUMBERVALUE.empty =NUMBERVALUE("";".";",") cell #ERR 6.13.28 empty text is not an xsd:float (Excel returns 0) +NUMBERVALUE.text =NUMBERVALUE("abc";".";",") cell #ERR 6.13.28 not a number +NUMBERVALUE.long.decimal =NUMBERVALUE("1,5";",,";".") cell #ERR 6.13.28 constraint LEN(DecimalSeparator) = 1 (Excel uses the first character) +NUMBERVALUE.decimal.in.group =NUMBERVALUE("1,5";",";",.") cell #ERR 6.13.28 constraint: DecimalSeparator not in GroupSeparator +NUMBERVALUE.empty.group =NUMBERVALUE("1234.5";".";"") cell 1234.5 6.13.28 no group separator (Excel rejects an empty one) +NUMBERVALUE.decimal.only =NUMBERVALUE("1,5";",") cell 1.5 locale group separator dropped when it equals the given decimal separator +FINDB.basic =FINDB("b";"abc") cell 2 6.7.2 byte position +FINDB.case =FINDB("B";"abc") cell #ERR 6.7.2 case-sensitive like FIND +FINDB.start =FINDB("b";"abcb";3) cell 4 6.7.2 start byte +FINDB.notfound =FINDB("x";"abc") cell #ERR 6.7.2 not found +FINDB.start.zero =FINDB("a";"abc";0) cell #ERR 6.7.2 start below 1 +FINDB.start.past =FINDB("a";"abc";4) cell #ERR 6.7.2 start past the text +FINDB.dbcs =FINDB("国";"中国") cell 3 6.7.2 a CJK character counts 2 bytes (Excel counts 1 unless a DBCS language is set) +FINDB.mixed =FINDB("b";"a中b") cell 4 6.7.2 1 + 2 bytes before b (Excel counts 1 unless a DBCS language is set) +SEARCHB.basic =SEARCHB("B";"abc") cell 2 6.7.8 case-insensitive like SEARCH +SEARCHB.start =SEARCHB("b";"abcb";3) cell 4 6.7.8 start byte +SEARCHB.notfound =SEARCHB("x";"abc") cell #ERR 6.7.8 not found +SEARCHB.dbcs =SEARCHB("国";"中国") cell 3 6.7.8 a CJK character counts 2 bytes (Excel counts 1 unless a DBCS language is set) +REPLACEB.basic =REPLACEB("abc";2;1;"X") cell s:aXc 6.7.6 replace one byte +REPLACEB.insert =REPLACEB("abc";2;0;"X") cell s:aXbc 6.7.6 zero length inserts +REPLACEB.append =REPLACEB("abc";4;1;"X") cell s:abcX 6.7.6 start after the end appends +REPLACEB.truncate =REPLACEB("abc";2;10;"X") cell s:aX 6.7.6 length past the end +REPLACEB.start.zero =REPLACEB("abc";0;1;"X") cell #ERR 6.7.6 start below 1 +REPLACEB.negative =REPLACEB("abc";2;-1;"X") cell #ERR 6.7.6 negative length +REPLACEB.dbcs =REPLACEB("中国";3;2;"日") cell s:中日 6.7.6 second CJK character is bytes 3-4 (Excel counts 1 byte unless a DBCS language is set) +DATEDIF.d =DATEDIF(DATE(2024;1;1);DATE(2024;12;31);"d") cell 365 6.10.3 days +DATEDIF.m =DATEDIF(DATE(2024;1;15);DATE(2024;6;14);"m") cell 4 6.10.3 complete months +DATEDIF.m.incomplete =DATEDIF(DATE(2024;1;31);DATE(2024;2;29);"m") cell 0 6.10.3 no complete month gives 0 +DATEDIF.m.monthend =DATEDIF(DATE(2024;1;31);DATE(2024;3;31);"m") cell 2 6.10.3 month end to month end +DATEDIF.y =DATEDIF(DATE(2020;6;15);DATE(2024;6;14);"y") cell 3 6.10.3 complete years +DATEDIF.y.leapday =DATEDIF(DATE(2024;2;29);DATE(2025;2;28);"y") cell 0 6.10.3 leap day anniversary not reached +DATEDIF.ym =DATEDIF(DATE(2020;6;15);DATE(2024;8;20);"ym") cell 2 6.10.3 months ignoring years +DATEDIF.md =DATEDIF(DATE(2024;1;15);DATE(2024;3;10);"md") cell 24 6.10.3 days ignoring months and years +DATEDIF.md.negative =DATEDIF(DATE(2024;1;31);DATE(2024;3;1);"md") cell -1 6.10.3 as Excel: borrows the month before the end month (-1) +DATEDIF.yd =DATEDIF(DATE(2023;12;15);DATE(2024;1;10);"yd") cell 26 6.10.3 days ignoring years +DATEDIF.yd.leap =DATEDIF(DATE(1995;5;3);DATE(2009;4;28);"yd") cell 361 6.10.3 as Excel: end date moved into the start year +DATEDIF.upper =DATEDIF(DATE(2024;1;1);DATE(2024;12;31);"D") cell 365 format letters ignore case, as Excel +DATEDIF.reversed =DATEDIF(DATE(2024;12;31);DATE(2024;1;1);"d") cell #ERR start after end is an error, as Excel +DATEDIF.bad.format =DATEDIF(DATE(2024;1;1);DATE(2024;12;31);"x") cell #ERR 6.10.3 unknown format +DATEDIF.empty.format =DATEDIF(DATE(2024;1;1);DATE(2024;12;31);"") cell #ERR 6.10.3 unknown format +DATEDIF.time =DATEDIF(DATE(2024;1;1)+0.75;DATE(2024;1;2)+0.25;"d") cell 1 6.10.3 times of day ignored +ISOWEEKNUM.dec29 =ISOWEEKNUM(DATE(2024;12;29)) cell 52 6.10.12 Sunday 2024-12-29 is in week 52 +ISOWEEKNUM.dec30 =ISOWEEKNUM(DATE(2024;12;30)) cell 1 6.10.12 Monday 2024-12-30 starts week 1 of 2025 +ISOWEEKNUM.week53 =ISOWEEKNUM(DATE(2020;12;31)) cell 53 6.10.12 2020 has 53 weeks +ISOWEEKNUM.jan3 =ISOWEEKNUM(DATE(2021;1;3)) cell 53 6.10.12 still week 53 of 2020 +ISOWEEKNUM.thursday =ISOWEEKNUM(DATE(2026;1;1)) cell 1 6.10.12 Thursday 2026-01-01 is in week 1 +ISOWEEKNUM.noarg =ISOWEEKNUM() cell #ERR 6.10.12 one argument +WEEKNUM.onearg =WEEKNUM(DATE(2024;12;30)) cell #ERR WEEKNUM keeps two arguments; one-argument ISOWEEKNUM is its own function +F.DIST.cdf =F.DIST(2.5;5;10) cell 0.8979977233557302 6.18.22 FDIST left tail, cumulative by default +F.DIST.pdf =F.DIST(2.5;5;10;0) cell 0.09359475444968551 6.18.22 FDIST density +F.DIST.negative =F.DIST(-1;5;10) cell 0 6.18.22 0 for x < 0 (Excel #NUM!) +F.DIST.pole =F.DIST(0;1;5;0) cell #ERR 6.18.22 density error for r1 = 1 at x = 0 +F.DIST.zero.r1.2 =F.DIST(0;2;5;0) cell 1 density at x = 0 for r1 = 2 +F.DIST.bad.df =F.DIST(2.5;0;10) cell #ERR 6.18.22 r1 must be positive +F.DIST.plus.legacy =F.DIST(2.5;5;10)+FDIST(2.5;5;10) cell 1 left and right tails add up to 1 +F.INV.mid =F.INV(0.5;5;10) cell 0.9319331608510479 6.18.24 FINV left tail +F.INV.zero =F.INV(0;5;10) cell 0 6.18.24 p = 0 +F.INV.one =F.INV(1;5;10) cell #ERR 6.18.24 p = 1 has no finite x +F.INV.roundtrip =F.INV(F.DIST(2.5;5;10);5;10) cell 2.5 inverse of F.DIST +FDIST.legacy =FDIST(2.5;5;10) cell 0.10200227664426975 6.18.23 LEGACY.FDIST right tail, unchanged +FDIST.legacy.fourargs =FDIST(2.5;5;10;1) cell #ERR LEGACY.FDIST takes three arguments +FINV.legacy =FINV(0.1;5;10) cell 2.521640686209623 6.18.25 LEGACY.FINV right tail, unchanged +HYPGEOMDIST.pmf =HYPGEOMDIST(2;5;5;11) cell 0.4329004329004329 6.18.37 four arguments: probability mass +HYPGEOMDIST.pmf5 =HYPGEOMDIST(2;5;5;11;0) cell 0.4329004329004329 6.18.37 Cumulative FALSE +HYPGEOMDIST.cdf =HYPGEOMDIST(2;5;5;11;1) cell 0.6082251082251082 6.18.37 Cumulative TRUE +HYPGEOMDIST.cdf.top =HYPGEOMDIST(5;5;5;11;1) cell 1 6.18.37 all outcomes +HYPGEOMDIST.big.pmf =HYPGEOMDIST(900;1828;2033;4167) cell 0.021882406859493695 large arguments (trunk gave about 3.2E+181) +HYPGEOMDIST.big.cdf =HYPGEOMDIST(636;1828;2033;4167;1) cell 3.138874972924956e-58 far left tail +HYPGEOMDIST.x.gt.n =HYPGEOMDIST(6;5;10;20) cell #ERR 6.18.37 x > n +HYPGEOMDIST.args =HYPGEOMDIST(2;2;90) cell #ERR 6.18.37 four or five arguments +ERROR.TYPE.div0 =ERROR.TYPE(1/0) cell 2 6.13.11 #DIV/0! is 2 +ERROR.TYPE.na =ERROR.TYPE(NA()) cell 7 6.13.11 #N/A is 7 +ERROR.TYPE.ref.na =ERROR.TYPE(AM1) cell 7 6.13.11 cell holding #N/A +ERROR.TYPE.ref.div0 =ERROR.TYPE(AM2) cell 2 6.13.11 cell holding #DIV/0! +ERROR.TYPE.value =ERROR.TYPE(SQRT(-1)) cell 3 Err:502 counts as #VALUE!, as in the Excel export (Excel: #NUM! 6) +ERROR.TYPE.noerror =ERROR.TYPE(5) cell #N/A 6.13.11 a non-error is an error +ERROR.TYPE.text =ERROR.TYPE("t") cell #N/A 6.13.11 a non-error is an error +ERROR.TYPE.args =ERROR.TYPE() cell #ERR 6.13.11 one argument +ERRORTYPE.legacy =ERRORTYPE(1/0) cell 532 ORG.OPENOFFICE.ERRORTYPE keeps the internal code +ERRORTYPE.legacy.na =ERRORTYPE(NA()) cell 32767 ORG.OPENOFFICE.ERRORTYPE keeps the internal code +RRI.basic =RRI(10;100;200) cell 0.07177346253629313 6.12.44 (Fv/Pv)^(1/N) - 1 +RRI.zgz =ZGZ(10;100;200) cell 0.07177346253629313 old name ZGZ still read +ODDFPRICE.short =ODDFPRICE(DATE(2008;11;11);DATE(2021;3;1);DATE(2008;10;15);DATE(2009;3;1);0.0785;0.0625;100;2;1) cell 113.59771747407883 6.12.31 short odd first period (Excel example) +ODDFPRICE.long =ODDFPRICE(DATE(2022;8;2);DATE(2028;4;5);DATE(2021;11;16);DATE(2023;10;5);0.0764;0.1492;100;2;2) cell 71.46287909084108 6.12.31 long odd first period +ODDFPRICE.long.monthend =ODDFPRICE(DATE(2011;9;19);DATE(2031;11;14);DATE(2010;4;28);DATE(2012;11;14);0.0569;0.0035;95.5;1;2) cell 199.43997530092304 6.12.31 long odd first period, annual +ODDFPRICE.offschedule =ODDFPRICE(DATE(2005;1;27);DATE(2013;6;30);DATE(2005;1;1);DATE(2005;3;30);0.0648;0.129;100;4;4) cell #ERR first coupon not a coupon date of the maturity, as Excel +ODDFPRICE.redemption =ODDFPRICE(DATE(2008;11;11);DATE(2021;3;1);DATE(2008;10;15);DATE(2009;3;1);0.0785;0.0625;0;2;1) cell #ERR 6.12.31 Redemption > 0 +ODDFYIELD.short =ODDFYIELD(DATE(2008;11;11);DATE(2021;3;1);DATE(2008;10;15);DATE(2009;3;1);0.0575;84.5;100;2;0) cell 0.07724554159781741 6.12.32 Excel example +ODDFYIELD.long =ODDFYIELD(DATE(2022;8;2);DATE(2028;4;5);DATE(2021;11;16);DATE(2023;10;5);0.0764;ODDFPRICE(DATE(2022;8;2);DATE(2028;4;5);DATE(2021;11;16);DATE(2023;10;5);0.0764;0.1492;100;2;2);100;2;2) cell 0.1492 6.12.32 inverse of ODDFPRICE +ODDFYIELD.redemption =ODDFYIELD(DATE(2008;11;11);DATE(2021;3;1);DATE(2008;10;15);DATE(2009;3;1);0.0575;84.5;0;2;0) cell #ERR 6.12.32 Redemption > 0 diff --git a/test/odf-validate/calcval.py b/test/odf-validate/calcval.py index dc322a1e2e..06b12a53b3 100644 --- a/test/odf-validate/calcval.py +++ b/test/odf-validate/calcval.py @@ -57,7 +57,8 @@ def read_cases(path): # Analysis add-in functions are not known by their English names to setFormula; # the case formulas keep the ODF names and are rewritten to the programmatic names. -ADDIN = {"RECEIVED": "getReceived", "BESSELK": "getBesselk", "BESSELY": "getBessely", "CONVERT": "getConvert"} +ADDIN = {"RECEIVED": "getReceived", "BESSELK": "getBesselk", "BESSELY": "getBessely", "CONVERT": "getConvert", + "ODDFPRICE": "getOddfprice", "ODDFYIELD": "getOddfyield"} def api_formula(f):
