Problem description: Entering decimal values into GCD_ADD returns a wrong result when a value greater than 10 is entered.
Steps to reproduce:
1. In a default installation of LibreOffice, open an instance of Calc.
2. Open the Function Wizard
3. Double-click the GCD_ADD function to select it.
4. Enter values such as 2.1, 4.2, 6.4 and 10.5 into the Numbers list.
The result returned is wrong. Remove the 10.5 value and the result is correctly given as 2.1.
The result of 2.1 should be returned for all the example values.
The input parameters are stated to be Numbers, not Integers.
Operating System: Windows XP
Version: 22.214.171.124 release
GCD function works only for integers, as it is described in the ODF standard:
or in Excel help:
GCD rounds input numbers down to integer and returns integers, but GCD_ADD apparently returns decimal values - maybe this is a bug.
Yes. No problem with GCD, only with GCD_ADD.
OK, I confirm this as a bug: GCD_ADD function does not convert input values to integers and returns rationals. E.g.:
GCD_ADD(2.1;4.2) returns 2.1, should return 2
GCD(2.1;4.2) returns 2 correctly
This is probably inherited from OO - see also https://issues.apache.org/ooo/show_bug.cgi?id=71158 where the same behaviour (returning rationals) was corrected for GCD function.
The GCD_ADD function is present to offer compatibility with the Excel add-in function GCD from Excel 2003 and earlier (xls).
The GCD function is fully ODFF1.2 compliant and is compatible with the Excel function GCD from Excel 200 and newer (xlsx).
Because GCD_ADD is an add-in function in Excel, it must be handled quite differently from GCD on export/import to/from Excel. Also, effectively, it is an outdated function, available only for backward compatibilty (xls). Patching this function seems to be a waste of time.
I will see if I can remove the GCD_ADD for the user, and substitute GCD with GCD_ADD when exporting to xls. When that is complete, all GCD_ADD uses from the past (in xls and in ods) will be automatically transferred to GCD.
The current behaviour is that GCD_ADD already is being substituted to GCD in ods, but GCD_ADD is still in the function list, so it's somewhat confusing.
No easy way to remove GCD_ADD from the user interface.
There are more add-in functions that only reside in Calc because of compatibility with xls, which is obsolete since 2003 when Microsoft introduced xlsx. (Gradually) removing these from the user interface is on my list, but not with the highest priority.
-GCD_ADD is an add-in function for import from xls documents,
-GCD exports fine to xls,
-GCD works correctly,
-on import from xlsx GCD is used,
-when using GCD_ADD in and ods document, it will be converted to GCD automatically,
I close this bug as 'WORKSFORME'.