Problem Statement
He inscribed and circumscribed regular polygons in/around a circle and calculated their perimeter. These are lower (inscribed polygon) and upper (circumscribed polygon) bounds for the perimeter of the circle, and therefore can be used to calculate lower and upper bounds for Pi. He then found a formula for directly calculating the perimeter of inscribed and circumscribed polygons with 2*n sides only using the values previously calculated for polygons with n sides.
You now have a slightly simpler task, considering only inscribed polygons. You are given an

Definition
- Class:
- Archimedes
- Method:
- approximatePi
- Parameters:
- int
- Returns:
- double
- Method signature:
- double approximatePi(int numSides)
- (be sure your method is public)
Notes
- Perimeter of a circle: 2 * PI * radius
- Perimeter of a n-sided regular polygon: n * sidelength
- Reminder how doubles are evaluated:If your result is within 1e-9 of the expected result, your solution will be evaluated as correct.If your result is between (1+1e-9) * expected and (1-1e-9) * expected, it will be evaluated as correct.
Constraints
- numSides will be between 3 and 100000, inclusive.
Examples
3
Returns: 2.598076211353316
8
Returns: 3.0614674589207183
17280
Returns: 3.1415926362832276
4
Returns: 2.82842712474619
5
Returns: 2.938926261462366
6
Returns: 2.9999999999999996
7
Returns: 3.037186173822907
8
Returns: 3.0614674589207183
99999
Returns: 3.1415926530730114
100000
Returns: 3.1415926530730216
48
Returns: 3.1393502030468667
11
Returns: 3.0990581252557265
83
Returns: 3.1408425675666343
80
Returns: 3.140785260725489
68
Returns: 3.140475187910292
349
Returns: 3.1415502262546897
308
Returns: 3.141538178911329
558
Returns: 3.141576056601735
700
Returns: 3.141582107247802
129
Returns: 3.141282121798652
3523
Returns: 3.141592237225897
1162
Returns: 3.141588826347538
1540
Returns: 3.141590474591773
9361
Returns: 3.1415925946167045
7638
Returns: 3.1415925650091037
57303
Returns: 3.1415926520160147
15275
Returns: 3.141592631441721
80110
Returns: 3.1415926527845537
21281
Returns: 3.14159264217904
19060
Returns: 3.141592639364783
100000
Returns: 3.1415926530730216
100000
Returns: 3.1415926530730216