121
4
4 Instructions 4.4.3 Trigonometric Functions
◆
Function
The sine of the designated angle (measured in radians) is calculated. The variable is in binary oating-point
number format.
S is the angular variable whose sine is to be calculated, in the unit of rad and in binary oating-point
number format. The value range is 0 ≤ α ≤ 2π.
D is the sine storage unit, in binary oating-point number format.
Example 1:
ǒDTAN D20 D30Ǔ
X2
DS
The tangent of the angle measured in radians in (D21, D20)
is calculated. The result is stored in (D31, D30).
The source data and SIN operation result are in binary oating-point number format.
According to the equation Angle in radians = Angle in degrees x π/180°, an angle of 360° is converted to
radians as follows: 360° x π/180° = 2π.
Example 2:
ǒMOVP K45 D10Ǔ
X0
X0 and X1 determine the angle measured in degrees, which is 45° or 60°.
The result is stored in D10.
ǒMOVP K60 D10Ǔ
X1
ǒFLT D10 D20Ǔ
M8000
ǒDEDIV K31415926 K1800000000 D24Ǔ
ǒDEMUL D20 D24 D30Ǔ
ǒDSIN D30 D40Ǔ
The decimal number in D10 is converted to a binary floating-point number.
The result is stored in (D21, D20).
The floating-point value of (±/180) is calculated
and stored in (D25, D24).
The floating-point degrees in (D21, D20) are converted to radian
equivalent. The result is stored in (D31, D30).
The sine of the floating-point radians in (D31, D30) is calculated in float-point
number format. The result is stored in (D41, D40).
Program for calculating the sine of an angle measured in degrees:
COS: Binary oating point COS operation
◆
Overview
The COS instruction calculates the cosine of the designated angle (measured in radians). The variable is in
binary oating-point number format.
COS S D
Binary oating
point COS
operation
Applicable model:
H3U
S Data source
Angular variable whose cosine is to be calculated,
in the unit of rad and in binary oating-point number
format; value range: 0 ≤ α ≤ 2π
32-bit instruction
(9 steps)
DCOS:
Continuous
execution
DCOSP: Pulse
execution
D
Operation
result
Cosine storage unit, in binary oating-point number
format