Factorial: Difference between revisions
Content added Content deleted
Basicgames (talk | contribs) |
(Replace println() with print(); replace output "syntaxhighlight" tag with "pre" tag) |
||
Line 3,750: | Line 3,750: | ||
// 128-bit test |
// 128-bit test |
||
UInt128 bigNum = 34; |
UInt128 bigNum = 34; |
||
console. |
console.print($"factorial({bigNum})={factorial(bigNum)}"); |
||
// 64-bit test |
// 64-bit test |
||
for (Int i : 10..-1) |
for (Int i : 10..-1) |
||
{ |
{ |
||
console. |
console.print($"factorial({i})={factorial(i)}"); |
||
} |
} |
||
} |
} |
||
Line 3,761: | Line 3,761: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
{{out}} |
|||
Output: |
|||
<pre> |
|||
<syntaxhighlight> |
|||
factorial(34)=295232799039604140847618609643520000000 |
factorial(34)=295232799039604140847618609643520000000 |
||
factorial(10)=3628800 |
factorial(10)=3628800 |
||
Line 3,775: | Line 3,775: | ||
factorial(1)=1 |
factorial(1)=1 |
||
factorial(0)=0 |
factorial(0)=0 |
||
</syntaxhighlight> |
|||
2023-01-19 10:14:52.716 Service "ShowFactorials" (id=1) at ^ShowFactorials (CallLaterRequest: native), fiber 1: Unhandled exception: IllegalArgument: "n >= Value.zero()": n=-1, Value.zero()=0, Value=Int |
|||
at factorial(Type<IntNumber>, factorial(?)#Value) (test.x:5) |
|||
at run() (test.x:19) |
|||
at ^ShowFactorials (CallLaterRequest: native) |
|||
</pre> |
|||
=={{header|EGL}}== |
=={{header|EGL}}== |