Time a function: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: added identity and total functions, and proper output) |
|||
Line 1,597: | Line 1,597: | ||
<lang maple>CodeTools:-Usage(ifactor(32!+1), output = cputime, quiet);</lang> |
<lang maple>CodeTools:-Usage(ifactor(32!+1), output = cputime, quiet);</lang> |
||
=={{header|Mathematica}}== |
=={{header|Mathematica}}/{{header|Wolfram Language}}== |
||
<lang Mathematica>AbsoluteTiming[x];</lang> |
<lang Mathematica>AbsoluteTiming[x];</lang> |
||
where x is an operation. Example calculating a million digits of Sqrt[3]: |
where x is an operation. Example calculating a million digits of Sqrt[3]: |
||
<lang Mathematica>AbsoluteTiming[N[Sqrt[3], 10^6]]</lang> |
<lang Mathematica>AbsoluteTiming[N[Sqrt[3], 10^6]]</lang> |
||
{{out}} |
|||
gives: |
|||
<lang Mathematica>{0.000657, 1.7320508075688772935274463......}</lang> |
<lang Mathematica>{0.000657, 1.7320508075688772935274463......}</lang> |
||
First elements if the time in seconds, second elements if the result from the operation. Note that I truncated the result. |
First elements if the time in seconds, second elements if the result from the operation. Note that I truncated the result. |