※スタイルシート未対応ブラウザではレイアウトを正確に再現できません。
> | advanced by | contents  | that returns in <
< [modosusu] > Color magazine monochrome light and shade   font predetermined, Gothic Ming-style type longhand   size Konaka large   standard

Various calculations

1. ..clause 1..: Absolute value
2. ..clause 2..: Involution
3. ..clause 3..: Square root(√)
4. ..clause 4..: Trigonometric

[1] Absolute value

Use the abs function to calculate the absolute value.
# include < stdlib.h > is necessary to use the abs function.

[   Absolute value   ]
Distance on [sen] number ..repaired.. from starting point.
In short, a positive value is a numerical value that exactly does a negative as it is value.
The usage of the abs function is as follows.
```

```
The following program is an example of requesting the absolute value.
```
#include <stdio.h> #include <stdlib.h>

void main(void)
{
printf("%d\n",abs(10));
printf("%d\n",abs(-10));

return;
}
```
The execution result of this program becomes as follows.

10
10

It returns to contents.

[2] Involution

Use the pow function to calculate the involution.
# include < math.h > is necessary to use the pow function.

The usage of the pow function is as follows.
It becomes inaccurate if it memorizes it by the int type because the value becomes double type.

```

```
The following program is an example of requesting the involution.
```
#include <stdio.h> #include <math.h>

void main(void)
{

Printf ("%d multiplication = %f\n of %d"  5, 2, and pow(5,2));
Printf ("%d multiplication = %f\n of %d"  8, 3, and pow(8,3));
Printf ("%d multiplication = %f\n of %d"  2, 10, and pow(2,10));

return;
}
```
The execution result of this program becomes as follows.

The second power = of five 25.000000
The third power = of eight 512.000000
The tenth power = of two 1024.000000

It returns to contents.

[3] Square root(√)

Use the sqrt function to calculate a square root.
# include < math.h > is necessary to use the sqrt function.

[   Square root   ]
Numerical value that becomes number when doing by the second power.
When former numerical value is assumed to be an area of a square, the square root hits near length.
The usage of the sqrt function is as follows.
It becomes inaccurate if it memorizes it by the int type because the value becomes double type.
```

```
The following program is an example of requesting the square root.
```
#include <stdio.h> #include <math.h>

void main(void)
{
printf("√%d = %f : %f * %f = %f\n",100,sqrt(100),sqrt(100),sqrt(100),sqrt(100) * sqrt(100));
printf("√%d = %f : %f * %f = %f\n",2,sqrt(2),sqrt(2),sqrt(2),sqrt(2) * sqrt(2));

return;
}
```
The execution result of this program becomes as follows.

√100 = 10.000000 : 10.000000 * 10.000000 = 100.000000
√2 = 1.414214 : 1.414214 * 1.414214 = 2.000000
Though it seems to be computable accurately because it is rounded off
When a similar calculation is repeated, ..error margin.. [derutame] attention is necessary.

It returns to contents.

[4] Trigonometric

Use the following function to calculate trigonometric.
# include < math.h > is necessary to use these functions.
Function name Trigonometric value
sin Signature
cos Cosine
tan Tangent
asin Arc signature
acos Arc cosine
atan Arc tangent

[   Arc trigonometric system   ]
The arc trigonometric the system does a usual, trigonometric reverse-calculation.
Though usual trigonometric requests a near ratio of length from the angle
The arc trigonometric the system requests the angle from a near ratio of length.
It explains both of the usage of these functions as an example of the tan function thereafter because it is the same.
The usage of the tan function is as follows.
```
タンジェント = tan(ラジアン角度);
```
However, this angle is not an angle where 90 degrees that we usually use become right-angled.
Use the unit of the angle that is called a radian.
It is possible to convert it from a usual angle to the radian by the following expression.

The circular arc is length of the radius and a unit of the angle of which one radian is the position becomes equal.
Use the radian in the world of computer in case of almost.
Doing this calculation every time makes the following macros because it is troublesome.
```
#define RADIAN(ARC) ((ARC) * 3.14159 / 180)
```
When looking up at the tree from a position 5m away of the person of the height 160cm, the following program :.
It is an example of requesting the height of the tree when the angle is 40 degrees.
```
#include <stdio.h> #include <math.h>

#define RADIAN(ARC) ((ARC) * 3.14159 / 180)

void main(void)
{
double stature = 160;
double distance = 500;
double arc = 40;
double tree;

tree = distance * tan(RADIAN(arc)) + stature;
printf("%fm\n",tree / 100);

return;
}
```
The execution result of this program becomes as follows.

5.795493m
When trigonometric repeats the calculation, ..error margin.. [derutame] attention is necessary.

It returns to contents.

< - It is advanced -> | in | head that returns  to returning  next |.