Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.2 - 日本語

Change language to:
English - Français - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Scilabヘルプ >> Scilab > Configuration > recursionlimit

recursionlimit

get or set the current or maximal allowed depth of nested calls

Syntax

currentMaxDepth = recursionlimit()
formerMaxDepth = recursionlimit(newMaxDepth)
currentDepth = recursionlimit("current")

Arguments

currentMaxDepth

Maximal number of nested calls (= depth) currently set.

newMaxDepth

New maximal number of nested calls to set.

formerMaxDepth

Former value set, before it was changed

"current"

input keyword retrieving the current calling depth (before reaching the max one).

currentDepth

Current calling depth.

Description

Use this function to change the maximal number of nested calls allowed in Scilab. Each script.sce, public or internal (like overloads) functions in Scilab language, or built-in functions compiled from an external language is a level. Default value is set to 1000 levels.

newMaxDepth can be set in Scilab preferences.

Examples

recursionlimit(20);
function testRecursion()
    printf("recursion: %d\n", recursionlimit("current") - 1);
    testRecursion;
endfunction

testRecursion;
//show that cos and %rec_cos increment the current recursion level.
recursionlimit(40);
function %rec_cos(val)
    printf("recursion: %d\n", recursionlimit("current") - 1);
    val.count = val.count + 1;
    //disp(val.count);
    cos(val);
endfunction

a = tlist(["rec", "count"], 0);
cos(a)
recursionlimit(10);
function [out]=recfib(in)
    printf("recursion: %d\n", recursionlimit("current") - 1);
    if in == 1  then
        out = 1;
    elseif in == 2
        out = 1;
    else
        out = recfib(in-1) + recfib(in-2);
    end
endfunction

recfib(10); //OK
recfib(11); //KO

See Also

  • where — カレントの命令の呼び出しツリーを得る
  • getmemory — 利用可能なシステムメモリおよびシステムメモリの総量を返す
  • preferences — Scilab設定ウィンドウを開く

History

バージョン記述
6.0.0 Function added
Report an issue
<< oldEmptyBehaviour Configuration sciargs >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Feb 14 15:01:59 CET 2019