JPH01259420A - Trigonometric function arithmetic unit - Google Patents

Trigonometric function arithmetic unit

Info

Publication number
JPH01259420A
JPH01259420A JP8712888A JP8712888A JPH01259420A JP H01259420 A JPH01259420 A JP H01259420A JP 8712888 A JP8712888 A JP 8712888A JP 8712888 A JP8712888 A JP 8712888A JP H01259420 A JPH01259420 A JP H01259420A
Authority
JP
Japan
Prior art keywords
trigonometric function
value
sine
cosine
approximation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP8712888A
Other languages
Japanese (ja)
Inventor
Hiroko Ichikawa
裕子 市川
Tatsuya Yaguchi
達也 矢口
Yutaka Inoue
豊 井上
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP8712888A priority Critical patent/JPH01259420A/en
Publication of JPH01259420A publication Critical patent/JPH01259420A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To reduce the capacity of a data table and quickly perform arithmetic operation by using since or cosine values of equal angles, by which a prescribed angle is equally divided into (n), and sine or cosine values calculated by approximation to calculate the value of the trigonometric function in accordance with the addition theorem. CONSTITUTION:At least since or cosine values of equal angles by which the prescribed angle is divided into (n) are stored in a storage means, and at least two equal angles nearest to an input argument are selected by the storage means. Sine or cosine values of values obtained by subtracting equal angles from the argument are calculated by approximation, and sine or cosine values of selected equal angles and sine or cosine values calculated by approximation are used to calculate the value of the trigonometric function by four rules of arithmetic in accordance with the addition theorem of the trigonometric function. Thus, the trigonometric function value of high precision is calculated with a small storage area and a small quantity of calculation.

Description

【発明の詳細な説明】 [a業上の利用分野] 本発明は引数と求める三角関数を入力し、三角関数の計
算を行う三角関数演算装置に関するものである。
DETAILED DESCRIPTION OF THE INVENTION [Field of Application in Business A] The present invention relates to a trigonometric function calculation device that receives arguments and trigonometric functions to be sought and calculates the trigonometric functions.

[従来の技術] 計算機等で、与えられた引数に対応する正弦値又は余弦
値等の三角関数の計算を行う場合、従来は予め引数に対
応する正弦値や余弦値をテーブル等の記憶領域に記憶さ
せておき、それらを参照して計算を行っていた。また、
このようなテーブルを使用しない場合は、有理関数式で
近似する方法等が用いられていた。
[Prior Art] When calculating a trigonometric function such as a sine value or a cosine value corresponding to a given argument using a calculator, conventionally, the sine value or cosine value corresponding to the argument is stored in a storage area such as a table in advance. I memorized them and used them to perform calculations. Also,
When such a table is not used, methods such as approximation using rational function expressions have been used.

[発明が解決しようとする問題点コ しかしながら、前者のテーブル参照方式で三角関数の計
算を行い、その精度を上げようとすると莫大な記憶領域
が必要になる。一方、後者の近似法で精度上げようとす
ると計算量が多くなるため計算時間が長くなるという欠
点があった。
[Problems to be Solved by the Invention] However, if the former table reference method is used to calculate trigonometric functions and the accuracy is to be improved, a huge amount of storage space is required. On the other hand, when trying to improve accuracy using the latter approximation method, there is a drawback that the amount of calculation increases and the calculation time becomes longer.

本発明は上記従来例に鑑みてなされたもので、少ない記
憶領域と少ない計算量で、精度の高い三角関数値を算出
できる三角関数演算装置を提供することを目的とする。
The present invention has been made in view of the above conventional example, and an object of the present invention is to provide a trigonometric function calculation device that can calculate highly accurate trigonometric function values with a small storage area and a small amount of calculation.

[問題点を解決するための手段] 上記目的を達成するために本発明の三角関数7寅算装置
は以下のような構成からなる。即ち、入力された引数に
対応して、指示された三角関数の計算を行う三角関数演
算装置であって、所定角度をn等分した等分角の少なく
とも正弦値或いは余弦値を記憶する記憶手段と、前記引
数に最も近い少なくとも2つの前記等分角を選択する選
択手段と、前記引数より前記等分角を減算した僅の正弦
値或いは余弦値を近似法により算出する手段と、選択さ
れた前記等分角の正弦値或いは余弦値及び近似により算
出された正弦値或いは余弦値とを用い、前記三角関数の
加法定理に従って加減乗除により前記三角関数の値を算
出する算出手段とを備える。
[Means for Solving the Problems] In order to achieve the above object, the trigonometric function calculation device of the present invention has the following configuration. That is, it is a trigonometric function calculation device that calculates a designated trigonometric function in accordance with an input argument, and a storage means that stores at least a sine value or a cosine value of an angle obtained by dividing a predetermined angle into n equal parts. , selection means for selecting at least two of the equidistant angles closest to the argument, and means for calculating, by an approximation method, a small sine or cosine value obtained by subtracting the equidistant angle from the argument; Calculating means for calculating the value of the trigonometric function by addition, subtraction, multiplication, and division according to the addition theorem of the trigonometric function using the sine value or cosine value of the equidistant angle and the sine value or cosine value calculated by approximation.

[作用] 以上の構成において、記憶手段に所定角度をn等分した
等分角の少なくとも正弦値或いは余弦値を記憶しておき
、入力された引数に最も近い少なくとも2つの等分角を
、記憶手段より選択する。
[Operation] In the above configuration, at least the sine value or cosine value of an equal angle obtained by dividing a predetermined angle into n equal parts is stored in the storage means, and at least two equal angles closest to the input argument are stored. Choose from the means.

その引数より等分角を減算した値の正弦値或いは余弦値
を近似法により算出し、選択された等分角の正弦値或い
は余弦値及び近似により算出された正弦値或いは余弦値
とを用いて、三角関数の加法定理に従って加減乗除によ
り三角関数の値を算出するように動作する。
Calculate the sine or cosine value of the value obtained by subtracting the equal angle from the argument using an approximation method, and use the sine or cosine value of the selected equal angle and the sine or cosine value calculated by the approximation. , operates to calculate the value of a trigonometric function by addition, subtraction, multiplication, and division according to the addition theorem of trigonometric functions.

[実施例] 以下、添付図面を参照して本発明の好適な実施例を詳細
に説明する。
[Embodiments] Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the accompanying drawings.

[演算装置の説明 (第1図)] 第1図は実施例の演算装置の概略構成を示すブロック図
である。
[Description of the arithmetic device (FIG. 1)] FIG. 1 is a block diagram showing a schematic configuration of the arithmetic device of the embodiment.

図中、10は例えばマイクロプロセッサ等のCPUを備
えた制御部で、そのCPUはプログラムROMIIに記
憶され、第2図のフローチャートで示された制御プログ
ラムに従って各種制御信号を出力して装置全体の制御を
行っている。12は後述する正弦値や余弦値を格納して
いるテーブルROMで、三角関数の演算時に参照される
In the figure, 10 is a control unit equipped with a CPU such as a microprocessor, and the CPU is stored in a program ROMII and outputs various control signals according to the control program shown in the flowchart of FIG. 2 to control the entire device. It is carried out. A table ROM 12 stores sine values and cosine values, which will be described later, and is referenced when calculating trigonometric functions.

13は引数や、求めたい三角関数の種類(正弦、余弦ま
たは正接)等を入力する入力部で、例えばキーボード等
で構成されている。14は計算結果を表示出力する出力
部で、例えばLEDやCRT等のデイスプレィやプリン
タ等で構成されている。15は加減乗除の計算を行う演
算部で、制御部10より与えられた正弦値や余弦値等を
基に、それらの値の乗算や加算等を行い、その結果を制
御部10に出力する。
Reference numeral 13 denotes an input section for inputting arguments, the type of trigonometric function desired (sine, cosine, or tangent), etc., and is composed of, for example, a keyboard. Reference numeral 14 denotes an output unit for displaying and outputting calculation results, and is comprised of, for example, a display such as an LED or CRT, a printer, or the like. Reference numeral 15 denotes an arithmetic unit that performs calculations of addition, subtraction, multiplication, and division, and based on the sine value, cosine value, etc. given from the control unit 10, multiplies and adds these values, and outputs the results to the control unit 10.

[計算方法の説明 (第2図、第3図)〕第2図は実施
例の演算装首における正弦値を算出する制御プログラム
のフローチャートで、本プログラムは入力部13より引
数が入力されて、演算する三角関数の種類が指示される
ことにより開始される。
[Description of calculation method (Figs. 2 and 3)] Fig. 2 is a flowchart of a control program for calculating the sine value in the arithmetic unit of the embodiment. The process starts when the type of trigonometric function to be calculated is specified.

まずステップS1で入力部13より引数Xと求めたい三
角関数の種類(正弦(sin ) )が入力されるとス
テップS2に進む。
First, in step S1, the argument X and the type of trigonometric function to be obtained (sin) are input from the input unit 13, and the process proceeds to step S2.

本実施例は、引数X=a+bとすると、sin (X)
=sin (a)  ・cos (b)+cos (a
)  1s t n (b)の加法定理よりs in 
(X)の値を求めるものである。
In this example, if the argument X=a+b, then sin (X)
= sin (a) ・cos (b) + cos (a
) 1s t n From the addition theorem of (b), s in
This is to find the value of (X).

テーブルROM12(7)テーブル121には、2πを
n等分した値(小さいほうからa O+a I+a 2
+・・・、aN−1)に対する正弦値及び余弦値を格納
している。尚、これら80〜a N−1はラジアンの値
である。
Table ROM 12 (7) Table 121 contains values obtained by dividing 2π into n equal parts (from the smallest to a O+a I+a 2
+..., aN-1) are stored. Note that these 80 to a N-1 are values in radians.

従って、ステップS2では引数Xより、al≦X<a+
++ となる、al とa l+1を決定する。
Therefore, in step S2, from the argument X, al≦X<a+
++ Determine al and a l+1.

第3図はこれらaのテーブル121の具体例を示す図で
、31は2πを4等分したaの数値と、それらに対応す
る正弦値と余弦値の例を示している。尚、ここで正弦値
と余弦値は小数点以下2桁で示されているが、実際は精
度を上げるために、更に桁数が多く設定されている。
FIG. 3 is a diagram showing a specific example of the table 121 of these a, and 31 shows an example of the numerical values of a obtained by dividing 2π into four, and the corresponding sine and cosine values. Note that although the sine value and cosine value are shown here with two digits below the decimal point, in reality, more digits are set to increase accuracy.

ここでは、2π(=ラジアンで約6.28)を4等分し
た値としてalを決定している。よって、a o−0,
00,a 1−1.57.  a 2−3.14.  
a 3−4.71となる。
Here, al is determined as a value obtained by dividing 2π (=about 6.28 in radians) into four equal parts. Therefore, a o-0,
00,a 1-1.57. a 2-3.14.
a 3-4.71.

よって、いまステップS1で引数としてX=2及び5i
nXの計算が指示されると、ステップS2では、a、と
じてat ==1.57が、a 141 としてa2=
3.14が遭択される(at≦2くa2)。
Therefore, now in step S1, X=2 and 5i are used as arguments.
When the calculation of nX is instructed, in step S2, a, then at ==1.57, a 141 and a2=
3.14 is encountered (at≦2×a2).

こうして次にステップS3で、b=2−1.57=0.
43を求めるとともに、テーブルROM12よりsin
 (1,57)とcos(1,57)の値を読み出し、
それぞれをA=sin  (1,57) B−cos (f、57)とする。
In this way, in step S3, b=2-1.57=0.
43 and sin from table ROM12.
Read the values of (1, 57) and cos (1, 57),
Let A=sin (1, 57) B-cos (f, 57), respectively.

次にステップS4で、マクロ−リン展開による近似式に
より、5in(b)とcos (b)の近似を行う。
Next, in step S4, 5in(b) and cos(b) are approximated using an approximation equation based on Macrolin expansion.

これは以下の展開式を用いるもので、 を使用して、Cに関してはn=3まで、Dに関してはn
=2まで展開し、 C=−b+b’ /6−b5/120 D=1−b” +b’/24 よりCとDの値を求める。
This uses the following expansion formula, and for C up to n=3 and for D up to n
=2, and find the values of C and D from C=-b+b'/6-b5/120 D=1-b''+b'/24.

ステップS5ではこれらA〜Dの値を演算器15に出力
して、AxD+BxCの計算を行い、その結果をs i
n (X)の計算結果として出力部14に出力する。
In step S5, these values A to D are output to the arithmetic unit 15 to calculate AxD+BxC, and the result is s i
It is output to the output unit 14 as the calculation result of n (X).

こうすることにより、例えば2π分のラジアン値(小数
点以下2桁まで)のテーブルを設けると、π=3.14
として全体で629のテーブルを要するのに対し、この
実施例によればaのテーブル数が4 (4/629舛1
/157)で足りることになる。
By doing this, for example, if we provide a table of radian values for 2π (up to 2 digits after the decimal point), π = 3.14
, a total of 629 tables are required, whereas according to this embodiment, the number of tables for a is 4 (4/629 tables 1
/157) will be sufficient.

このマクロ−リン展開は正弦、余弦の最も簡単な近似式
であり、”0”の近傍では高い精度が得られるが、“0
”から離れるに従ってその誤差は大きくなる。この実施
例では“X−a”という微小部分にこの展開式を用いて
いるため、少ない項数(n=2或いは3程度)で非常に
良い精度が得られる利点がある。
This Macrolin expansion is the simplest approximation formula for sine and cosine, and high accuracy can be obtained near "0", but "0"
The error increases as it moves away from ``.'' In this example, this expansion formula is used for the minute part ``X-a'', so very good accuracy can be obtained with a small number of terms (n = about 2 or 3). It has the advantage of being

また、π/2以上の引数Xに対しては、π/ 2<X<
πでは、s in (X) −s in (π/2−X
)π<X<3yr/ 2では、sin (X)−sin
 (X−π/2)3π/ 2<X<2aでは、sin 
(X) ・−5in (2π−X)という関係式を用い
ることによって、テーブルROM12に記憶しておく正
弦値及び余弦値の量は、2πまで必要でなく、その1/
4で済むことになる。
Furthermore, for an argument X greater than or equal to π/2, π/2<X<
For π, sin (X) − sin (π/2−X
)π<X<3yr/2, sin (X)−sin
(X-π/2)3π/2<X<2a, sin
By using the relational expression (X) ・-5in (2π-X), the amount of sine and cosine values stored in the table ROM 12 does not need to be up to 2π, but can be reduced to 1/2π.
4 will suffice.

更に、 cos (X) =s i n (yr/2−X)の関
係より、正弦値のみのテーブルを持たせておくだけで余
弦値も求めることができるため、テーブルROMのデー
タ量を更に1/2にすることができる。
Furthermore, from the relationship cos (X) = sin (yr/2 - /2.

尚、本実施例では正弦値のみを持たせるように説明した
が、cos (X) =sin (π/2−X)の関係
より、余弦値のみのテーブルを持たせるようにしてもよ
いことはもちろんである。
In addition, although this embodiment has been explained so as to have only sine values, it is also possible to have a table of only cosine values due to the relationship cos (X) = sin (π/2-X). Of course.

以上説明したように本実施例によれば、従来のテーブル
ROMのデータ量を大幅に減少することができ、近似式
による演算も加減算と乗算だけで少ない項数で達成でき
るため、演算に要する時間もはるかに少なくて済む効果
がある。
As explained above, according to this embodiment, the amount of data in the conventional table ROM can be significantly reduced, and calculations using approximate expressions can be accomplished with a small number of terms using only addition, subtraction and multiplication, so the time required for calculations is reduced. It has the effect of requiring far less.

[発明の効果] 以上説明したように本発明によれば、正弦値や余弦値等
のデータテーブルの量を少なくできるととともに、高速
に三角関数の演算ができるという効果がある。
[Effects of the Invention] As described above, according to the present invention, the amount of data tables such as sine values and cosine values can be reduced, and trigonometric function calculations can be performed at high speed.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は実施例の演算装置の構成を示すブロック図、 第2図は実施例の正弦値を求めるフローチャート、 第3図は実施例におけるテーブル121の具体例を示す
図である。 図中、10・・・制御部、11・・・プログラムROM
、12・・・テーブルROM、13・・・入力部、14
・・・出力部、15・・・演算部、121・・・テーブ
ルである。 第1図 第2図
FIG. 1 is a block diagram showing the configuration of the arithmetic unit of the embodiment, FIG. 2 is a flowchart for calculating the sine value of the embodiment, and FIG. 3 is a diagram showing a specific example of the table 121 in the embodiment. In the figure, 10...control unit, 11...program ROM
, 12...Table ROM, 13...Input section, 14
. . . output section, 15 . . . arithmetic unit, 121 . . . table. Figure 1 Figure 2

Claims (3)

【特許請求の範囲】[Claims] (1)入力された引数に対応して、指示された三角関数
の計算を行う三角関数演算装置であつて、 所定角度をn等分した等分角の少なくとも正弦値或いは
余弦値を記憶する記憶手段と、 前記引数に最も近い少なくとも2つの前記等分角を選択
する選択手段と、 前記引数より前記等分角を減算した値の正弦値或いは余
弦値を近似法により算出する手段と、選択された前記等
分角の正弦値或いは余弦値及び近似により算出された正
弦値或いは余弦値とを用い、前記三角関数の加法定理に
従つて加減乗除により前記三角関数の値を算出する算出
手段とを備えることを特徴とする三角関数演算装置。
(1) A trigonometric function calculation device that calculates specified trigonometric functions in accordance with input arguments, and has a memory that stores at least the sine value or cosine value of an angle divided into n equal parts of a predetermined angle. means for selecting at least two of the equal angles closest to the argument; and means for calculating, by an approximation method, a sine or cosine value of a value obtained by subtracting the equal angle from the argument; calculation means for calculating the value of the trigonometric function by addition, subtraction, multiplication, and division according to the addition theorem of the trigonometric function, using the sine value or cosine value of the equisecting angle and the sine value or cosine value calculated by approximation; A trigonometric function calculation device comprising:
(2)前記所定角度はπ/2の整数倍の角度であること
を特徴とする特許請求の範囲第1項に記載の三角関数演
算装置。
(2) The trigonometric function calculation device according to claim 1, wherein the predetermined angle is an angle that is an integral multiple of π/2.
(3)前記近似法はマクローリン展開による近似法であ
ることを特徴とする特許請求の範囲第1項に記載の三角
関数演算装置。
(3) The trigonometric function calculation device according to claim 1, wherein the approximation method is an approximation method using Maclaurin expansion.
JP8712888A 1988-04-11 1988-04-11 Trigonometric function arithmetic unit Pending JPH01259420A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP8712888A JPH01259420A (en) 1988-04-11 1988-04-11 Trigonometric function arithmetic unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP8712888A JPH01259420A (en) 1988-04-11 1988-04-11 Trigonometric function arithmetic unit

Publications (1)

Publication Number Publication Date
JPH01259420A true JPH01259420A (en) 1989-10-17

Family

ID=13906325

Family Applications (1)

Application Number Title Priority Date Filing Date
JP8712888A Pending JPH01259420A (en) 1988-04-11 1988-04-11 Trigonometric function arithmetic unit

Country Status (1)

Country Link
JP (1) JPH01259420A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001240392A (en) * 2000-02-28 2001-09-04 Tadano Ltd Method and device for calculating deflection angle for boom working vehicle
JP2003009599A (en) * 2001-06-18 2003-01-10 Mitsubishi Electric Corp Controller fo synchronous motor and elevator

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001240392A (en) * 2000-02-28 2001-09-04 Tadano Ltd Method and device for calculating deflection angle for boom working vehicle
JP4683686B2 (en) * 2000-02-28 2011-05-18 株式会社タダノ Method and apparatus for calculating deflection angle of boom work vehicle
JP2003009599A (en) * 2001-06-18 2003-01-10 Mitsubishi Electric Corp Controller fo synchronous motor and elevator

Similar Documents

Publication Publication Date Title
CN107273090A (en) Towards the approximate floating-point multiplier and floating number multiplication of neural network processor
Hough Applications of the proposed IEEE 754 standard for floating-point arithetic
CN109634558A (en) Programmable mixed-precision arithmetic element
Herbison-Evans Solving quartics and cubics for graphics
JPH01259420A (en) Trigonometric function arithmetic unit
US9582469B1 (en) System and methods for determining attributes for arithmetic operations with fixed-point numbers
US5648924A (en) Method and apparatus for finding arctangents
US4800514A (en) Electronic graphic arts proportional calculator
JPH01109428A (en) Trigonometric function arithmetic unit
Stewart On Lehmer’s method for finding the zeros of a polynomial
Huskey Technical Developments: Characteristics of the Institute for Numerical Analysis Computer
JPH086766A (en) Sine and cosine arithmetic device
US5646876A (en) Method and apparatus for reducing rounding error when evaluating binary floating point polynomials
Andrews et al. Evaluation of functions on microcomputers: square root
JPH0585924B2 (en)
Payne et al. Draft proposal for a binary normalized floating point standard
CA1173164A (en) Fraction calculator
JPH03192429A (en) Square root arithmetic unit
JPS6156523B2 (en)
Ehrman “Logical” arithmetic on computers with two's complement binary arithmetic
SU622087A1 (en) Sine and cosine function digital computer
JPS6225208B2 (en)
JP3978879B2 (en) COMPUTER DEVICE AND RECORDING MEDIUM CONTAINING COMPUTER PROCESSING PROGRAM
JP2000122979A (en) Calculating device and storage medium
SU926651A1 (en) Digital device for computing sine-cosine functions