Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Calculate the sine of x with precision of eps
- double mysin(double x, double eps) {
- double y = 0;
- double term = x;
- int i = 1;
- while (fabs(term) > eps) {
- y += term;
- term = -term * x * x / ((2 * i) * (2 * i + 1));
- i++;
- }
- return y;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement