JPH0285923A - Function value calculating device - Google Patents

Function value calculating device

Info

Publication number
JPH0285923A
JPH0285923A JP15483288A JP15483288A JPH0285923A JP H0285923 A JPH0285923 A JP H0285923A JP 15483288 A JP15483288 A JP 15483288A JP 15483288 A JP15483288 A JP 15483288A JP H0285923 A JPH0285923 A JP H0285923A
Authority
JP
Japan
Prior art keywords
value
function
sine
cosine
values
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
JP15483288A
Other languages
Japanese (ja)
Inventor
Hiroko Ichikawa
裕子 市川
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 JP15483288A priority Critical patent/JPH0285923A/en
Publication of JPH0285923A publication Critical patent/JPH0285923A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To shorten the calculating time by performing the calculation of a trigonometric function with the addition, subtraction and multiplication only and with no division. CONSTITUTION:A 1st memory means 101 stores the value of a sine function and/or the value of a cosine function against the value within one cycle. While a 2nd memory means 102 stores the information corresponding to the input value in a format of floating decimals including the data on an exponential part and a mantissa part. Then a calculation means 103 obtains the corresponding value of a sine function and/or a cosine function against the input value by reference to a 2nd recording means in response to the corresponding mantissa and exponential part data and by reference to a 1st recording medium based on the mantissa part data. The value of the sine or cosine function is calculated to the input value with use of a formula for n-fold angle (n: an integer) of a trigonometric function against the value of the sine or cosine function and the exponential part data. Thus the values of sine and cosine functions can be obtained with the addition, subtraction and multiplication only. In such a way, a desired trigonometric function is obtained in a short time.

Description

【発明の詳細な説明】 [産業上の利用分野] 本発明は関数値計算装置に関し、特に3角関数の計算を
行なうのに好適な関数値計算装置に関するものである。
DETAILED DESCRIPTION OF THE INVENTION [Industrial Field of Application] The present invention relates to a function value calculation device, and particularly to a function value calculation device suitable for calculating trigonometric functions.

[従来の技術] 特定の関数、例えば3角関数に関する数値計算は、電子
計算機等における演算に欠くことのできない基本機能の
一つである。
[Prior Art] Numerical calculations regarding specific functions, such as trigonometric functions, are one of the basic functions essential for calculations in electronic computers and the like.

電子計算機において、与えられた入力値に対応する3角
関数の値を計算するためには、任意の入力値に対してπ
でモジュロを取って計算することが行なわれている。
In an electronic computer, in order to calculate the value of a trigonometric function corresponding to a given input value, it is necessary to calculate π for any input value.
Calculations are performed by taking the modulo.

第6図はモジュロを取って3角関数(この場合、正弦関
数(y=sin x))の値を計算する処理手順の一例
を示すフローチャートである。
FIG. 6 is a flowchart showing an example of a processing procedure for calculating the value of a trigonometric function (in this case, a sine function (y=sin x)) by taking the modulo.

まず、ステップ561において所定の値を入力する。次
にステップS62の操作を実施することにより、Xが−
π/2≦X≦π/2に変換される。ステップ562にお
いて“cint”という関数はX/πの値を整数値にす
る時に、小数点以下を四捨五入する操作を行なうのに用
いられる。次にステップS63において、マクロ−リン
展開等によりXの値を代入してyの値を求める。そして
、ステップS64においてtの値が奇数であった場合、
y”−yとすることで(ステップ565)、y−sin
 xの値が求められる。
First, in step 561, a predetermined value is input. Next, by performing the operation in step S62, X becomes -
It is converted to π/2≦X≦π/2. In step 562, the function "cint" is used to round off the decimal point when converting the value of X/π to an integer value. Next, in step S63, the value of y is determined by substituting the value of X using Macrolin expansion or the like. Then, if the value of t is an odd number in step S64,
y”-y (step 565), y-sin
The value of x is found.

このような処理手順を見ることにより、 −π/2≦X
≦π/2の範囲でsin Xの値を求めることができる
By looking at such processing steps, −π/2≦X
The value of sin X can be determined in the range of ≦π/2.

元来、正弦関数は2πを周期とする関数であるので、−
π/2≦X≦π/2以外の範囲、すなわち、−π≦X≦
πやO≦X≦2πの範囲を求めるためには、正弦関数の
符号の付は替えが必要である。
Originally, the sine function is a function with a period of 2π, so -
Range other than π/2≦X≦π/2, that is, −π≦X≦
In order to find the range of π and O≦X≦2π, it is necessary to change the sign of the sine function.

いずれにしても、従来の関数値計算装置においては、所
定の値に対して3角関数を求めるためにπでモジュロを
取る必要がある。そのため、引数のモジュロを取る過程
において除算が必須のものとなフていた。
In any case, in the conventional function value calculation device, it is necessary to take the modulo of π in order to obtain a trigonometric function for a predetermined value. Therefore, division was essential in the process of taking the modulo of the argument.

しかしながら、マルチプロセッサユニット(MPU)ま
たはディジタルシグナルプロセッサ(osp)における
除算の実行時間は、加減乗算の実行時間の何倍も要する
のが普通であり、その分計算時間が長くなるという問題
点が生じていた。このように計算時間が長くなるという
ことは、取りも直さずMPtiまたはDSPのスルーブ
ツトが低下することに他ならない。
However, the execution time for division in a multiprocessor unit (MPU) or digital signal processor (OSP) is usually many times longer than the execution time for addition, subtraction, and multiplication, which creates the problem that the calculation time increases accordingly. was. Such an increase in calculation time simply means that the throughput of MPti or DSP is reduced.

[発明が解決しようとする課題] そこで、本発明の目的は従来の問題点を解消し、3角関
数の計算を、除算を行なうことなく加減乗算のみを用い
て行なうようにすることにより、計算時間が少なくてす
み、かつ計算装置のスルーブツトを低下させることのな
い関数値計算装置を提供することにある。
[Problems to be Solved by the Invention] Therefore, an object of the present invention is to solve the conventional problems and to solve the problems by calculating trigonometric functions using only addition, subtraction, and multiplication without performing division. It is an object of the present invention to provide a function value calculation device that requires less time and does not reduce the throughput of the calculation device.

[課題を解決するための手段] かかる目的を達成するために、本発明は、第1図に示す
ように、入力値の正弦関数の値、余弦関数の値を出力す
る関数値計算装置において、1周期以内の値に対する正
弦関数の値および/または余弦関数の値が格納されてい
る第1の記憶手段101と入力値に対応した情報が、指
数部データと仮数部データとを有する浮動小数のフォー
マットで格納されている第2の記憶手段102と、入力
値に対して、前記第2の記録手段を参照して、対応した
仮数部データと指数部データとに対応して、該仮数部デ
ータを基に前記第1の記録手段を参照して対する正弦関
数の値および/または正弦関数の値を求め、当該求めら
れた値と、前記指数部データとに対して3角関数のn倍
角(ただし、nは整数)の公式を適用することにより、
前記入力値に対する正弦関数の値または余弦関数の値を
計算する計算手段103とを具えたことを特徴とする。
[Means for Solving the Problems] In order to achieve the above object, the present invention provides a function value calculation device that outputs a sine function value and a cosine function value of an input value, as shown in FIG. The first storage means 101 stores the values of the sine function and/or the cosine function for values within one period, and the information corresponding to the input value is a floating point number having exponent data and mantissa data. With reference to the second storage means 102 stored in the format of the input value, the mantissa data is stored in correspondence with the corresponding mantissa data and exponent data. , the value of the sine function and/or the value of the sine function are determined with reference to the first recording means, and the n times angle ( However, by applying the formula (n is an integer),
It is characterized by comprising a calculation means 103 for calculating a value of a sine function or a value of a cosine function for the input value.

[作 用] 本発明によれば任意の値に対してπでモジュロを取る必
要がなく、加減乗算のみで正弦関数の値、余弦関数の値
を計算することがでさるため、短い計算時間で所望の3
角関数が得られる。
[Function] According to the present invention, there is no need to take the modulo of π for any value, and the values of the sine function and cosine function can be calculated only by addition, subtraction, and multiplication, so the calculation time is short. desired 3
An angular function is obtained.

[実施例] 以下、本発明の詳細な説明する。[Example] The present invention will be explained in detail below.

実施例1 正弦関数の値あるいは余弦関数の値を求めるは、以下の
三角関数の倍角公式: %式% を利用する。
Example 1 To find the value of the sine function or the value of the cosine function, use the following double angle formula for trigonometric functions: %Formula%.

ここで、マルチプロセッサユニット(MPU)の内部に
おいて、浮動小数点は次のフォーマットによって表現さ
れる。すなわち、 x−(−1)” x 1.F x 2@(1)であって
、ここで、Sは符号部であり、eは指数部であり、1.
Fは仮数部に相当して、1.Fの値は−2から2までの
範囲にある。
Here, floating point numbers are expressed in the following format inside the multiprocessor unit (MPU). That is, x-(-1)" x 1.F x 2@(1), where S is the sign part, e is the exponent part, and 1.
F corresponds to the mantissa part, 1. The value of F ranges from -2 to 2.

上述した浮動小数点のフォーマットは、後述するCPU
内では第2図に示すような形式で格納されている。
The floating point format described above is
It is stored in the format shown in Figure 2.

上述した(1)式においてXを2で割ることは指数部の
eから1を引くことに等しい。
In the above equation (1), dividing X by 2 is equivalent to subtracting 1 from the exponent part e.

以上を前提として以下に本実施例を具体的に説明する。Based on the above, this embodiment will be specifically described below.

第3図は本発明の関数値計算装置の一実施例を示すブロ
ック図である。31は、−πからπまでの値に対する正
弦関数の値および/または余弦関数の値を計算する関数
計算器、32は関数値計算装置全体を制御する中央処理
装置(CPU) 、33は(:Pt133に内蔵され、
第4図につき後述する処理手順に対応したプログラム等
が格納されているリードオンリメモリ(ROM)である
。34はCPt132の命令に従って計算処理を行なう
計算処理装置、35は計算を行なうにあたり人力される
数値を格納するレジスタ等を設けたランダムアクセスメ
モリ(RAM)である。
FIG. 3 is a block diagram showing an embodiment of the function value calculation device of the present invention. 31 is a function calculator that calculates a sine function value and/or a cosine function value for values from -π to π, 32 is a central processing unit (CPU) that controls the entire function value calculation device, and 33 is (: Built into Pt133,
This is a read-only memory (ROM) in which programs and the like corresponding to the processing procedure described later with reference to FIG. 4 are stored. 34 is a calculation processing device that performs calculation processing in accordance with the instructions of the CPt 132, and 35 is a random access memory (RAM) provided with registers and the like for storing numerical values entered manually during calculation.

第4図は本発明の関数値計算装置の処理手順の一例を示
すフローチャートである。
FIG. 4 is a flowchart showing an example of the processing procedure of the function value calculation device of the present invention.

まず、ステップ541において、Xの浮動小数表現の1
.FをRAM35内のレジスタAに格納し、指数部eの
部分をRAM35内のレジスタBに格納する。
First, in step 541, 1 of the floating point representation of
.. F is stored in register A in RAM 35, and the exponent part e is stored in register B in RAM 35.

ここで、レジスタAに格納されている値、すなわち1.
Fは−2から2までの範囲にあるので、当然−πからπ
までの範囲内にある。従って、関数計算器によって、−
2から2までの値に対する正弦関数の値、および/また
は余弦関数の値を求めることができる。
Here, the value stored in register A, namely 1.
F is in the range from -2 to 2, so naturally it is from -π to π
It is within the range of Therefore, −
The value of the sine function and/or the value of the cosine function can be determined for values between 2 and 2.

次に、ステップ542において、計算処理装置34によ
り5in(A)をレジスタCに格納し、かつcos (
A)をレジスタDに格納する。ステップS43において
計算処理装置において2XCXD、2XD”−1を計算
して、それぞれレジスタEおよびレジスタFに格納する
Next, in step 542, the calculation processing unit 34 stores 5in (A) in the register C, and cos (
A) is stored in register D. In step S43, the calculation processing device calculates 2XCXD and 2XD"-1 and stores them in register E and register F, respectively.

ステップS44において、Bの値を1減じて、改めてB
と置く。ステップS45において、このBの値が0より
も大きいか否かを判断する。ステップS45において、
B>Oであると判定された時は、ステップ546におい
て、レジスタEおよびレジスタFに格納されている値を
、それぞれレジスタCおよびレジスタDとして計算して
ステップS43に戻る。以下同様の手順を経て、正弦関
数の値および/または余弦関数の値を求めることができ
る。
In step S44, the value of B is subtracted by 1 and the value of B is
Put it as. In step S45, it is determined whether the value of B is greater than 0 or not. In step S45,
When it is determined that B>O, in step 546, the values stored in register E and register F are calculated as register C and register D, respectively, and the process returns to step S43. Following the same procedure, the value of the sine function and/or the value of the cosine function can be determined.

ステップS45において、B≦0ならはステップS47
に進み、5in(x)の時はEの値を繰り返して、また
cos (x)の時はFの値を繰り返して終了する。
In step S45, if B≦0, step S47
Then, when 5in(x), the value of E is repeated, and when cos (x), the value of F is repeated, and the process ends.

夫五■ユ 本実施例においては、以下の公式を用いて正弦関数の値
、余弦関数に値を計算する。3角関数の倍角の公式によ
れば x”’nxaの時(+、+ n−整数値)、である。こ
こで、[]はGaussの記号を表わしここで、マルチ
プロセッサユニットの内部において、浮動小数は実施例
1と同様に x= (−1)X1.F X2@ によって表現される。
In this embodiment, the following formulas are used to calculate the values of the sine function and cosine function. According to the double angle formula of trigonometric functions, when x'''nxa (+, + n - integer value).Here, [] represents the Gaussian symbol, and inside the multiprocessor unit, A floating point number is expressed by x= (-1)X1.F X2@ as in the first embodiment.

本実施例においては、実施例1の関数値計算装置のブロ
ック図とほぼ同じであるが、本実施例においてはレジス
タEおよびレジスタFがない構成となっている。
The present embodiment is almost the same as the block diagram of the function value calculation device of the first embodiment, but this embodiment does not have the register E and the register F.

第5図は本発明の関数値計算装置の他の処理手順の一例
を示すフローチャートである。
FIG. 5 is a flowchart showing an example of another processing procedure of the function value calculation device of the present invention.

x”nxa に対して、符号部S、指数部e、仮数部1.Fが自ら決
定される。
For x''nxa, the sign part S, the exponent part e, and the mantissa part 1.F are determined by itself.

まず、ステップS51において、Xの浮動小数表現の仮
数部をRAM35のレジスタAに格納し、指数部2@の
部分をRAM35内のレジスタBに格納する。
First, in step S51, the mantissa of the floating point representation of X is stored in register A of the RAM 35, and the exponent part 2@ is stored in register B of the RAM 35.

ここで、レジスタA&:格納されている値、すなわち1
.Fは−2から2*での範囲にあるので、当然−πから
πまでの範囲内にある。従って関数計算器31によって
、−2から2までの値に対応する正弦関数の値、余弦関
数の値を求めることができる。
Here, register A&: the stored value, i.e. 1
.. Since F is in the range from -2 to 2*, it is naturally in the range from -π to π. Therefore, the function calculator 31 can calculate the values of the sine function and the cosine function corresponding to values from -2 to 2.

次に、ステップ552において、関数値計算器により5
in(^)をレジスタCに格納し、cos (A)をレ
ジスタDに格納す・る。ステップS53においてを計算
する。このようにして倍角の公式を利用して所定の正弦
関数の値、余弦関数の値を計算することができる。
Next, in step 552, the function value calculator
Store in(^) in register C and store cos(A) in register D. is calculated in step S53. In this way, the value of a predetermined sine function and cosine function can be calculated using the double angle formula.

上述の各実施例において、関数計算器31に格納されて
いるーπからπまでの入力値に対する正弦関数の値、余
弦関数の値は−π/2からπ/2まで値を基本として求
めることができる。すなわち、π/2からπ/2までの
値に対してはマクロ−リン展開等により求めることがで
きる。−πから−π/2までの値に対してはy−sin
 (x+π)より求めることができるし、π/2からπ
までの値に対してはy−sin (x−π)により求め
ることができる。
In each of the above embodiments, the values of the sine function and the cosine function for input values from -π to π stored in the function calculator 31 can be calculated based on values from -π/2 to π/2. can. That is, values from π/2 to π/2 can be determined by macrolin expansion or the like. y-sin for values from −π to −π/2
It can be found from (x+π), and from π/2
Values up to can be determined by y-sin (x-π).

このようにして、1周期内の値を求めることができる。In this way, values within one period can be determined.

ここで、始めに5in(x)の値が求まればcos(x
)−sin(x+  π/2)−sin(yc/2−x
Jより求めることができる。
Here, if the value of 5in(x) is found first, cos(x
)-sin(x+π/2)-sin(yc/2-x
It can be obtained from J.

さらに、jan (x)については、 tan (x)虐sin (x)/cos (耳)より
求めることができる。
Furthermore, jan (x) can be obtained from tan (x) sin (x)/cos (ear).

[発明の効果] 以上説明したように、本発明によれば任意の値に対して
πでモジュロを取る必要がなく、加減乗算のみで正弦関
数の値、余弦関数の値を計算することができるため、短
い計算時間で所望の3角関数が得られるという利点を有
する。
[Effects of the Invention] As explained above, according to the present invention, it is not necessary to take the modulo of π for any value, and it is possible to calculate the value of a sine function and the value of a cosine function only by addition, subtraction, and multiplication. Therefore, it has the advantage that a desired trigonometric function can be obtained in a short calculation time.

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

第1図は本発明の関数値計算装置の基本構成例−を示す
ブロック図、 第2図は中央処理装置における浮動小数が格納されてい
る状況を示す説明図、 第3図は本発明の関数計算装置の実施例を示すブロック
図、 第4図は本発明の関数値計算装置の処理手順の一例を示
すフローチャート、 第5図は本発明の関数値計算装置の処理手順の一例を示
すフローチャート、 第6図は従来の正弦関数の計算のために処理手順を示す
フローチャートである。 101・・・第1の記憶手段、 102・・・第2の記憶手段、 103・・・計算手段、 31−・・関数計算器、 32・・・中央処理装置(cpu)、 33・・・ROM 。 34・・・計算処理装置、 35・・・RAM 。 番奄明0関オ欠イ置劃ト芹末(jf)基本楕へイγりを
ホすフ゛口・り図本疹明の開オ又値針尊裂又〃災北イ月
を示すブロック図第3図 ↓々ミ米 4ン 正 ダ玄 1/1.4門(イf(a〕
 討2/)だiブI)Aシし環1員を示すフローチャー
ト 第3図
Fig. 1 is a block diagram showing an example of the basic configuration of a function value calculation device of the present invention, Fig. 2 is an explanatory diagram showing a situation in which floating point numbers are stored in a central processing unit, and Fig. 3 is a function value calculation device of the present invention. A block diagram showing an embodiment of the calculation device; FIG. 4 is a flowchart showing an example of the processing procedure of the function value calculation device of the present invention; FIG. 5 is a flowchart showing an example of the processing procedure of the function value calculation device of the invention; FIG. 6 is a flowchart showing a conventional processing procedure for calculating a sine function. 101... First storage means, 102... Second storage means, 103... Calculation means, 31-... Function calculator, 32... Central processing unit (CPU), 33... ROM. 34... Computation processing device, 35... RAM. A block showing the beginning of the opening, the breaking of the value needle, and the month of disaster. Diagram 3
Figure 3 is a flowchart showing one member of the ring.

Claims (1)

【特許請求の範囲】 1)入力値の正弦関数の値、余弦関数の値を出力する関
数値計算装置において、 1周期以内の値に対する正弦関数の値および/または余
弦関数の値が格納されている第1の記憶手段と 入力値に対応した情報が、指数部データと仮数部データ
とを有する浮動小数のフォーマットで格納されている第
2の記憶手段と、 入力値に対して、前記第2の記録手段を参照して、対応
した仮数部データと指数部データとに対応して、該仮数
部データを基に前記第1の記録手段を参照して対する正
弦関数の値および/または正弦関数の値を求め、当該求
められた値と、前記指数部データとに対して3角関数の
n倍角(ただし、nは整数)の公式を適用することによ
り、前記入力値に対する正弦関数の値または余弦関数の
値を計算する計算手段と を具えたことを特徴とする関数値計算装置。
[Claims] 1) A function value calculation device that outputs a sine function value and a cosine function value of an input value, wherein the sine function value and/or the cosine function value for values within one period are stored. a second storage means in which information corresponding to the input value is stored in a floating point format having exponent data and mantissa data; The value of the sine function and/or the sine function is determined by referring to the first recording means based on the corresponding mantissa data and exponent data. The value of the sine function for the input value or A function value calculation device comprising: calculation means for calculating a value of a cosine function.
JP15483288A 1988-06-24 1988-06-24 Function value calculating device Pending JPH0285923A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP15483288A JPH0285923A (en) 1988-06-24 1988-06-24 Function value calculating device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP15483288A JPH0285923A (en) 1988-06-24 1988-06-24 Function value calculating device

Publications (1)

Publication Number Publication Date
JPH0285923A true JPH0285923A (en) 1990-03-27

Family

ID=15592855

Family Applications (1)

Application Number Title Priority Date Filing Date
JP15483288A Pending JPH0285923A (en) 1988-06-24 1988-06-24 Function value calculating device

Country Status (1)

Country Link
JP (1) JPH0285923A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06195207A (en) * 1992-12-25 1994-07-15 Toshiba Corp Digital sine wave generation circuit

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06195207A (en) * 1992-12-25 1994-07-15 Toshiba Corp Digital sine wave generation circuit

Similar Documents

Publication Publication Date Title
JP4635087B2 (en) Improved floating-point unit for extension functions
EP0464493B1 (en) High-radix divider
US5957996A (en) Digital data comparator and microprocessor
JPH03135627A (en) Fuzzy arithmetic unit
JP2511527B2 (en) Floating point arithmetic unit
JP3556252B2 (en) Data processing system and method for calculating offset total
JPH0285923A (en) Function value calculating device
JPH01209530A (en) Arithmetic unit for exponent function
JPH0831029B2 (en) Approximate inverse generator for division
US4951238A (en) Processor for executing arithmetic operations on input data and constant data with a small error
JPH0584928B2 (en)
JPH04172526A (en) Floating point divider
RU2276805C2 (en) Method and device for separating integer and fractional components from floating point data
JP3745673B2 (en) Processor
US20110119471A1 (en) Method and apparatus to extract integer and fractional components from floating-point data
JP4015411B2 (en) Arithmetic device and information processing apparatus using the arithmetic device
JP5939893B2 (en) Image processing apparatus and image processing method
JP2583599B2 (en) Binary integer multiplication processing method
JP2708526B2 (en) Binary integer division processing method
JP2972326B2 (en) Square root calculator
JP2508286B2 (en) Square root calculator
JPH04314126A (en) Inverse number generating device
JPH0371332A (en) Remainder multiplying circuit and remainder multiplying method
JP3659408B2 (en) Data arithmetic processing apparatus and data arithmetic processing program
JPH056393A (en) Function computing processor and its computing method