https://bugs.documentfoundation.org/show_bug.cgi?id=173905

            Bug ID: 173905
           Summary: Calc: Recursive LAMBDA functions do not work correctly
           Product: LibreOffice
           Version: 27.2.0.0 alpha0+ master
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Description:
>From LO 27.2 (current Master version) it is possible to define new functions
with the function LAMBDA, including recursive functions. In the help system, an
example of recursive definition is given for the factorial of n =
n*(n-1)*...*2*1, see
https://help.libreoffice.org/27.2/en-US/text/scalc/01/func_lambda.html
However, something goes wrong in the calculation, resulting in an owerflow
error.

Steps to Reproduce:
1. Open Calc in LO 27.2 (Master version)
2. Sheet > Named Ranges and Expressions > Define
3. Name: MY_FACTORIAL
4. Range or Formula expression: =LAMBDA(n;IF(n>1;n*MY_FACTORIAL(n-1);1))
5. Close with "Add".
6. Reopen definition: Sheet > Named Ranges and Expressions > Manage
7. Correct "my_factorial" to "MY_FACTORIAL" in the defintion.
8. Save correction with OK.
9. Write in cell B1: =MY_FACTORIAL(5) 

Actual Results:
Cell B1 shows: Err:514
(Internal owerflow)

Expected Results:
Cell B1 should show: 120
(5*4*3*2*1 = 120)


Reproducible: Always


User Profile Reset: No

Additional Info:
Step 6 and 7 is a workaround for the problem described in bug 173904.

The following version was used:

Version: 27.2.0.0.alpha0+ (X86_64)
Build ID: 70e6dd0eb1874f0c5e260948b2c8b9e192841372
CPU threads: 8; OS: Windows 11 X86_64 (build 26300); UI render: Skia/Raster;
VCL: win
Locale: da-DK (da_DK); UI: en-US
Calc: threaded

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to