Add files via upload

This commit is contained in:
Mateusz779 2021-08-27 18:47:17 +02:00 committed by GitHub
parent ae205f8738
commit 59c00f2f76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,12 +13,14 @@ from multiprocessing.dummy import Pool as Pool
from tqdm import tqdm from tqdm import tqdm
import argparse import argparse
def pi(start): def pi(start):
getcontext().prec = count - start getcontext().prec = count - start
for k in range(start, int(start + one_count)): for k in range(start, int(start + one_count)):
pbar.update(1) pbar.update(1)
list_all[k] = (1/Decimal(16)**k * (Decimal(4)/(8*k+1) - Decimal(2)/(8*k+4) - Decimal(1)/(8*k+5) - Decimal(1)/(8*k+6))) list_all[k] = (1/Decimal(16)**k * (Decimal(4)/(8*k+1) - Decimal(2)/(8*k+4) - Decimal(1)/(8*k+5) - Decimal(1)/(8*k+6)))
def main(): def main():
global count global count
global pbar global pbar
@ -45,7 +47,6 @@ def main():
one_count=int(count/tasks) one_count=int(count/tasks)
start_table = [int((one_count * i)) for i in range(tasks)] start_table = [int((one_count * i)) for i in range(tasks)]
start = time.time() start = time.time()
with Pool(processes=threads) as pool: with Pool(processes=threads) as pool:
results = pool.starmap( results = pool.starmap(
@ -69,11 +70,3 @@ def main():
f.close() f.close()
if __name__ == "__main__": if __name__ == "__main__":
main() main()