From a73a964e51247ed169d322c725a3a18859f109a3 Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Mon, 14 Jun 2021 00:00:37 +0000 Subject: python, hg: tow outside the environment. they've served us well, and can ride off into the sunset. --- sys/src/cmd/python/Demo/scripts/pi.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100755 sys/src/cmd/python/Demo/scripts/pi.py (limited to 'sys/src/cmd/python/Demo/scripts/pi.py') diff --git a/sys/src/cmd/python/Demo/scripts/pi.py b/sys/src/cmd/python/Demo/scripts/pi.py deleted file mode 100755 index 9b242451a..000000000 --- a/sys/src/cmd/python/Demo/scripts/pi.py +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env python - -# Print digits of pi forever. -# -# The algorithm, using Python's 'long' integers ("bignums"), works -# with continued fractions, and was conceived by Lambert Meertens. -# -# See also the ABC Programmer's Handbook, by Geurts, Meertens & Pemberton, -# published by Prentice-Hall (UK) Ltd., 1990. - -import sys - -def main(): - k, a, b, a1, b1 = 2L, 4L, 1L, 12L, 4L - while 1: - # Next approximation - p, q, k = k*k, 2L*k+1L, k+1L - a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1 - # Print common digits - d, d1 = a/b, a1/b1 - while d == d1: - output(d) - a, a1 = 10L*(a%b), 10L*(a1%b1) - d, d1 = a/b, a1/b1 - -def output(d): - # Use write() to avoid spaces between the digits - # Use str() to avoid the 'L' - sys.stdout.write(str(d)) - # Flush so the output is seen immediately - sys.stdout.flush() - -if __name__ == "__main__": - main() -- cgit v1.2.3