
Type: Bug

Status: Closed

Priority: Major

Resolution: Fixed

Affects Version/s: ODF 1.2

Fix Version/s: ODF 1.3

Component/s: OpenFormula, Part 4 (Formula) [1.2: 2]

Labels:None

Proposal:
When I resolve the optional parts [], I get seven valid syntax variants, here without data type.
A: IF(Condition)
B: IF(Condition
C: IF(Condition;IfTrue)
D: IF(Condition;
E: IF(Condition;;IfFalse)
F: IF(Condition;IfTrue
G: IF(Condition;IfTrue;IfFalse)
Some of them have missing parts. I should be able to determine the correct resulting value from the "Semantics"part. But that is not possible for all variants.
(use nonproportional font to get the table nice formatted)
Condition Condition Text in part Semantics
evaluates evaluates and the fitting syntax variants
to TRUE to FALSE 

result TRUE()   "If there is only 1 parameter, IfTrue is
considered to be TRUE()" fits to A  

result FALSE()  "If there are less than 3 parameters, IfFalse 
is considered to be FALSE()" fits to A,B,C  

result 0  "If there are 2 or 3 parameters but the second 
parameter is null (two consecutive ;;  
semicolons), IfFalse is considered to be 0."  
fits to B,D,E, perhaps C fits too.  

result 0  "If there are 3 parameters but the third 
parameter is null, IfFalse is considered to  
be 0." fits to D,F 
Problems:
(1) Variants B and C are ambiguous, see row 2 and row 3
(2) Why is a rule for IfFalse given, when the second parameter is missing, see row 3?
(3) If the third parameter is not null but IfFalse, then IfFalse should be returned, if Condition is FALSE, but semantics say 0 in row 3.
(4) For Condition TRUE in variants B, D and E no value for the missing second parameter is given. Perhaps the text "If there are 2 or 3 parameters but the second parameter is null (two consecutive ;;semicolons), IfTrue is considered to be 0." was intended?
(5) It is not clear, whether C fits to row 3.
Remarks.
In variant B and C with condition FALSE, Gnumeric and Excel return FALSE
In variant B,D, and E with condition TRUE, Gnumeric and Excel return 0 for the missing second parameter.
In variant E with condition FALSE, Gnumeric and Excel return IfFalse and not 0.
LibreOffice and AOO does not handle variants with ;; or