-->
当前位置:首页 > 题库

PROGRAMMING:cosine function

Luz5年前 (2021-05-10)题库425
According to McLaughlin formula, the cosine of any angle is calculated.
![ Title. JPG] (~ / b02e17a4-c95b-49b7-954f-4df545739385. JPG)
####Input format
> $$x$$ $$\epsilon$$
Note: $$x $$is the angle (unit: radian), $$$epsilon $$is the calculation precision.
####Output format
> $$y$$
Note: $$y $$is the cosine of $$x $$. Output 6 decimal places with% f format qualifier.
Requirement: the absolute value of the last item calculated is less than $$\ epsilon $$.
####Input sample 1
```in
1.047197551196598 0.00000001
```
####Output sample 1
```out
zero point five zero zero zero zero zero
```
####Input sample 2
```in
315.2064629101759 0.000001
```
####Output sample 2
```out
zero point five zero zero zero zero zero
```
Tip: convert x to the angle in the interval $$(- 2, PI, 2, PI) $, so as to improve the accuracy and speed up the calculation.







answer:If there is no answer, please comment