New submission from Darshan Kanade <kanadedars...@gmail.com>:

I was solving this problem to find the approximate value of pi using the 
Archimedes method using two different logics -

1) The first one used the formula pi = k*cos(90-180/k) but when I gave very 
large input, say k=2**62 sides of polygon, then it gives the value of pi as 
282.3843260569851... for comparatively smaller k=1000000 it is around 3.14

2)Because the first one was giving wrong answer for larger values, I googled 
for solution and came across this other logic using the formula pi = k * 
sin(180/k). 
In this method, we get values of pi around 3.14 no matter how large the input 
is, even if it is k=2**62!

----------
messages: 411005
nosy: Darshan
priority: normal
severity: normal
status: open
title: Wrong value of pi for larger values using math.cos() function
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46444>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to