Implementing alternate "compatibility" functions (such as 0^0 = ERROR)

Andrew Douglas Pitonyak andrew at pitonyak.org
Thu Feb 21 18:56:12 PST 2013


I was recently involved in a conversation related Calc and Excel 
compatibility. At issue is the fact that LO returns POWER(0,0) = 1 and 
Excel returns an error.

I have seen two primary means of dealing with this suggested. The first 
is to create a compatibility function for POWER(x,y) to match the 
behavior in Excel. My understanding of how this would work is as follows.

1. Create another function such as POWER.ALTERNATE(x,y) that behaves as 
desired.
2. When an Excel file is read, every instance of POWER is replaced with 
POWER.ALTERNATE.
3. When an Excel file is written, every instance of POWER.ALTERNATE is 
converted back to POWER.

I vaguely remember someone on list mentioning that they had implemented 
alternate Calc functions, but I do not remember the context.

This leaves a few questions in my mind.

(Q) Is a user able to use POWER.ALTERNATE inside of Calc?

(Q) When saved as an ODS file, certainly we don't want to write 
POWER.ALTERNATE because then it is using a nonstandard function that 
will not be used anywhere else and can only be read by AOO. In other 
words, I assume that we would always write POWER rather than 
POWER.ALTERNATE and the only way to retain the behavior is to save the 
file as an excel file or to mess with user defined attributes while 
writing the file.

XXXXXXXXXXXXXXXXXXXX

The alternate suggestion was to add a "compatibility mode". This has the 
advantage that it can be turned on and off at will so that Calc will 
simply behave that way. It also allows other functions to be changed to 
check the flag and behave accordingly. This also feels like a larger 
initial change and would require far more buy-in from the community to 
implement.

-- 
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php



More information about the LibreOffice mailing list