Time a function: Difference between revisions

m
m (→‎{{header|Phix}}: added identity and total functions, and proper output)
Line 1,597:
<lang maple>CodeTools:-Usage(ifactor(32!+1), output = cputime, quiet);</lang>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<lang Mathematica>AbsoluteTiming[x];</lang>
where x is an operation. Example calculating a million digits of Sqrt[3]:
<lang Mathematica>AbsoluteTiming[N[Sqrt[3], 10^6]]</lang>
{{out}}
gives:
<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.
1,111

edits