Update
This commit is contained in:
parent
124b9d1e7c
commit
3f374a4713
85 changed files with 2281 additions and 2272 deletions
22
sin.md
22
sin.md
|
@ -4,7 +4,7 @@ Sine, abbreviated *sin*, is a [trigonometric](trigonometry.md) [function](functi
|
|||
|
||||
The function is most commonly defined using a right triangle as follows. Consider the following triangle:
|
||||
|
||||
```
|
||||
```
|
||||
/|
|
||||
/ |
|
||||
/ |
|
||||
|
@ -26,8 +26,8 @@ The graph of the sine function is following:
|
|||
1_|_
|
||||
| .--'''--.
|
||||
-1/2 pi | _.'' ''._ 3/2 pi
|
||||
.________|________.'________|________'|________|________.' --> x
|
||||
'._ | _.'|0 | |'._ | _.'|
|
||||
.________|________.'________|________'|________|________.' --> x
|
||||
'._ | _.'|0 | |'._ | _.'|
|
||||
''--___--'' _|_ 1/2 pi pi ''--___--'' 2 pi
|
||||
-1 |
|
||||
```
|
||||
|
@ -86,7 +86,7 @@ unsigned char sin8(unsigned char x)
|
|||
a -= 128;
|
||||
flip = 1;
|
||||
}
|
||||
|
||||
|
||||
if (a > 63)
|
||||
a = 128 - a;
|
||||
|
||||
|
@ -157,26 +157,26 @@ Furthermore there exist other nice approximations, such as the extremely accurat
|
|||
/* Integer sine using Bhaskara's approx. Returns a number
|
||||
in <-UNIT, UNIT> interval. Argument is in radians * UNIT. */
|
||||
|
||||
int sinInt(int x)
|
||||
int sinInt(int x)
|
||||
{
|
||||
int sign = 1;
|
||||
|
||||
|
||||
if (x < 0) // odd function
|
||||
{
|
||||
x *= -1;
|
||||
sign = -1;
|
||||
}
|
||||
|
||||
|
||||
x %= 2 * PI;
|
||||
|
||||
|
||||
if (x > PI)
|
||||
{
|
||||
x -= PI;
|
||||
sign *= -1;
|
||||
}
|
||||
|
||||
|
||||
x *= PI - x;
|
||||
|
||||
|
||||
return sign * (16 * x) / ((5 * PI * PI - 4 * x) / UNIT);
|
||||
}
|
||||
```
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue