Each table row shows performance measurements for this Python 2 program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|
Read the ↓ make, command line, and program output logs to see how this program was run.
Read pidigits benchmark to see what this program should do.
# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/
#
# contributed Daniel Nanz
import sys
try:
import gmpy2 as gmpy
except ImportError:
import gmpy_cffi as gmpy
if not hasattr(gmpy, 'pi'):
gmpy.pi = gmpy.const_pi
def get_pistring(n, pi=gmpy.pi):
return str(pi(int(3.35 * n))).replace('.', '')[0 : n]
def main(n, width=10, line='{}\t:{}'):
pistring = get_pistring(n)
for i in range(0, n - width + 1, width):
print(line.format(pistring[i : i + width], i + width))
if n % width > 0:
print(line.format(pistring[-(n % width) : ].ljust(width), n))
main(int(sys.argv[1]))
Fri, 30 Oct 2020 20:17:49 GMT
COMMAND LINE:
/usr/bin/python2 pidigits.python-4.python 10000
PROGRAM FAILED
PROGRAM OUTPUT:
Traceback (most recent call last):
File "pidigits.python-4.python", line 10, in <module>
import gmpy_cffi as gmpy
ImportError: No module named gmpy_cffi