Now, let's return to the factorial function.
现在,让我们回到阶乘函数上来。
This limits greatly the possible range of your factorial function.
这极大地限制了阶乘函数的可能范围。
Therefore, you need to pass it as the first (and only) parameter to the factorial function.
因而,需要将其作为第一个(也是惟一一个)参数传递给factorial函数。
This functionality works well as a recursive application, as shown in the sample factorial function in Listing 4.
这个功能作为递归应用程序工作良好,如清单4中的样本阶乘函数所示。
We did the factorial function earlier and it's the product of a number and the factorial of that number minus one.
早些时候我们编写过一个计算fibtorial数的函数它便是某数与它减一的factorial数的积.
Don't be taken aback by the size of the code — it's mostly comments and declarations (the factorial function itself only has 16 instructions).
这段代码看起来比较多,但您也无需望而却步,因为其中大部分都是注释和声明(阶乘函数本身只有16个指令)。
The best way to see why stacks are needed is to look at recursive functions. For simplicity, let's look at the recursive implementation of the factorial function.
了解为什么需要堆栈的最好方法是查看递归函数的情况。
This function, since it calls itself, makes very good use of stack frames. Let's look at how the factorial function would work in assembly language (enter as factorial.s)
这个函数,从它调用自己开始,就很好地使用了堆栈帧。
Before moving into a discussion of the factorial function, look at the layout of a stack frame more closely. Here is how the stack is supposed to be laid out according to the abi.
在讨论factorial函数之前,先要了解堆栈框架的布局。
Since factorials of numbers less than 1 don't make any sense, we stop at the number 1 and return the factorial of 1 (which is 1). Therefore, the real factorial function will look like this
由于小于1的数的阶乘没有任何意义,所以我们在计算到数字 1 的时候停止,并返回 1的阶乘(即 1)。
The epilogue will be discussed in the analysis of the factorial code, but it basically just takes down the stack frame and returns to the previous function.
该段代码的尾声(epilogue)将在分析factorial 代码时再作讨论,但总的来说,它的作用是结束堆栈框架并返回到先前的函数。
The function would continually call factorial.
函数会连续不断地调用factorial。
You then branch to the function using brsl $lr, factorial.
然后需要使用brsl $lr, factorial对函数进行分支。
Write a function that calculates a number's factorial using recursion.
写出一个用递归来计算阶乘的函数。
Otherwise, a recursive function is used to calculate the factorial.
否则,使用递归函数计算阶乘。
In a straightforward way, this paper introduce the solution and each characteristic of marker methods, function methods, threshold methods and factorial methods based on VB environment.
该文中简单的介绍了基于VB环境的标记法、临界值判断法、函数法以及因子法的解题方法及它们各自的特点。
Using gamma function, the paper popularized the common conceptions of the usual factorial, permutation and combination and proved some combination formulas in common use.
依照伽马函数,对通常的阶乘、排列、组合的概念进行了推广,并证明了一些常用的组合公式。
Using gamma function, the paper popularized the common conceptions of the usual factorial, permutation and combination and proved some combination formulas in common use.
依照伽马函数,对通常的阶乘、排列、组合的概念进行了推广,并证明了一些常用的组合公式。
应用推荐