JPH0772860B2 - 演算方式 - Google Patents

演算方式

Info

Publication number
JPH0772860B2
JPH0772860B2 JP61259868A JP25986886A JPH0772860B2 JP H0772860 B2 JPH0772860 B2 JP H0772860B2 JP 61259868 A JP61259868 A JP 61259868A JP 25986886 A JP25986886 A JP 25986886A JP H0772860 B2 JPH0772860 B2 JP H0772860B2
Authority
JP
Japan
Prior art keywords
data
constant
value
digit
error
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.)
Expired - Lifetime
Application number
JP61259868A
Other languages
English (en)
Other versions
JPS63113629A (ja
Inventor
美小夜 笹原
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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP61259868A priority Critical patent/JPH0772860B2/ja
Priority to DE87116006T priority patent/DE3788713T2/de
Priority to EP87116006A priority patent/EP0268123B1/en
Priority to US07/114,975 priority patent/US4951238A/en
Publication of JPS63113629A publication Critical patent/JPS63113629A/ja
Publication of JPH0772860B2 publication Critical patent/JPH0772860B2/ja
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/483Computations with numbers represented by a non-linear combination of denominational numbers, e.g. rational numbers, logarithmic number system or floating-point numbers
    • G06F7/485Adding; Subtracting
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/544Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices for evaluating functions by calculation
    • G06F7/5446Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices for evaluating functions by calculation using crossaddition algorithms, e.g. CORDIC
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/544Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices for evaluating functions by calculation
    • G06F7/548Trigonometric functions; Co-ordinate transformations
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/60Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers
    • G06F7/72Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers using residue arithmetic
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2207/00Indexing scheme relating to methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F2207/38Indexing scheme relating to groups G06F7/38 - G06F7/575
    • G06F2207/3804Details
    • G06F2207/3808Details concerning the type of numbers or the way they are handled
    • G06F2207/3812Devices capable of handling different types of numbers
    • G06F2207/382Reconfigurable for different fixed word lengths
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/499Denomination or exception handling, e.g. rounding or overflow
    • G06F7/49936Normalisation mentioned as feature only

Landscapes

  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Analysis (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Computational Mathematics (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Nonlinear Science (AREA)
  • Complex Calculations (AREA)
  • Executing Machine-Instructions (AREA)

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は浮動小数点データ演算における演算方式に関す
る。
〔従来の技術〕
一般に、浮動小数点データの関数演算において、入力デ
ータの範囲が大きくなればなるほど、誤差も大きくなる
ことが知られている。三角関数や指数関数などの関数を
求める場合、入力データをある特定の定数を除数として
引き数還元(以下reductionという)を行ない、剰余の
結果を級数展開またはCORDICなどを利用して演算し、最
後に補正を行なって求めるのが、一般的な算法である
(「初等関数の数値計算」一松 信著 教育出版)。
この時の定数は無理数を有限桁で丸めたものであり、入
力データの仮数部と定数の仮数部が非常に近い値である
時桁落ちが生じ、桁落ちが生じたままCORDICや級数展開
などを利用して求められるため誤差が含まれてしまうの
である。例えば三角関数の計算を行なうと、第4図に示
されるように、nπ/2付近でreductionによる大幅な
誤差が生じる。入力された値から有効桁に丸められたπ
/2を減算して剰余を求める時に、第6図に示されるよう
に、入力数の仮数部の値が除数である定数π/2の仮数部
と近い値である時に演算結果の上位桁が0……0とな
り、有効数字が0の数だけ減少する。上位桁の0……0
は、仮数部Mの値を1≦M<2となるように正規化する
ことによって消せるが、正規化の際の仮数部の左シフト
において、下位桁には本来は有効数字で埋められなけれ
ばならないが、nπ/2の下位桁が反映されず、0……
0が入ってしまう。
これらの誤差について、従来では、2種類の対策がとら
れていた。第1の対策は、第6図または第7図に示され
るように、桁落ちによる誤差に対しての処置を何もせ
ず、誤差が含まれたままの演算結果を出力してしまうこ
とである。第2の対策は、第8図または第9図に示され
るように、内部に入力数、演算結果の2倍の長さの定
数、レジスタ、ALUを設けて演算を行なうことにより、r
eductionによる桁落ちを防いで誤差を縮小するものであ
る。
〔発明が解決しようとする問題点〕
上述した従来の演算方式では、桁落ちによる誤差に対し
ての処置を何もせず、誤差が含まれたままの演算結果を
出力してしまう第1の対策は、実行速度は早いが、桁落
ちが生じたまま演算してしまうため誤差については、何
も解決策にはなっておらず、関数の演算結果に対して信
用できない値を返してしまうという欠点があり、また、
内部に入力数、演算結果の2倍の長さの定数、レジス
タ、ALUを設けて演算を行なうことにより、reductionに
よる桁落ちを防いで誤差を縮小するという第2の対策で
は、誤差は縮小されるが内部の演算が2倍の精度になる
ため、大幅なハードウェアの増加が伴うという欠点があ
る。
〔問題点を解決するための手段〕
本発明の演算方式は、倍長の定数の上位桁を示す第1の
定数と下位桁を示す第2の定数と仮数部の桁数を示す第
3の定数とを格納するための定数ROMと、仮数部のMSBよ
り最初の1を検出する先行1検出回路と、指定された桁
数だけ右シフトあるいは左シフト可能なシフタと、入力
データの加算または減算を行う加減算器を有し、 入力データと定数ROMの第1の定数との減算を加減算器
により行ない、その演算結果を第1のデータとし、第1
のデータを先行1検出回路に入力することにより求めら
れた値を第2のデータとし、第2のデータをシフト桁数
として第1のデータをシフタにより左シフトした値を第
3のデータとし、第3の定数から第2のデータを減算し
た値を第4のデータとし、第4のデータをシフト桁数と
して、第2の定数をシフタにより右シフトした値を第5
のデータとして、第3のデータと第5のデータを加減算
器により加算または減算するものである。
すなわち、本発明は、ある特定の定数との減算を行なっ
た時に生じる桁落ちによる誤差を防ぐために、仮想的に
倍長の定数の上位桁と下位桁をもち、上位桁で生じた桁
落ちによる誤差を下位桁で補正することにより、特別な
ハードウェアの追加を伴うことなく、高精度の演算を実
行することができるようにしたものである。
〔実施例〕
次に、本発明の実施例について図面を参照して説明す
る。
まず、図面を用いて説明する前に、三角関数のsin Xを
例にとってアルゴリズムについて説明することにする。
第3図のアルゴリズムで示されるように、入力数Xを定
数π/2にてreductionを行ない剰余と商を求める。次に
商の値をもとに剰余の値の補正を行なったものをCORDIC
または展開式などを用いてsin Xを求める。
これはsin Xを求める方法の一例であるが、第4図に示
されるように入力数Xの仮数部の値がπ/2の仮数部の値
と近いときにreductionにより桁落ちが発生し、また、
第5図に示されるように剰余の補正する時にも桁落ちが
生じ、このようにして求められたsin Xの演算結果は、
桁落ちが生じたまま演算されてしまうため誤差が含まれ
るのである。
第1図は本発明の演算方式の一実施例のブロック図であ
る。第8図は、倍精度でX−π/2を行なった時の式を示
す図、第10図は2倍の長さの定数π/2の値を示す図、第
11図は本発明による単精度でのX−π/2を行なった時の
式を示す図である。
定数ROM101には倍長の定数の上位桁と下位桁と仮数部の
桁数も格納される。先行1検出回路102は仮数部のMSBか
ら最初の1を検出する。シフタ103は指定された桁数だ
け右シフトまたは左シフト可能である。加減算器104は
データの加算または減算を行なう。
まず、本実施例では、説明を分かりやすくするために表
わし得るデータとして、仮数部64ビット長、指数部15ビ
ット長、符号1ビット長、計80ビット長の浮動小数点デ
ータをとりあげ、reductionによる誤差を防ぐ方式につ
いて述べることにする。第10図に示されるように定数π
/2の値を内部では、仮想的に2倍の長さになるように上
位桁をπ/2(H)とし下位桁をπ/2(L)として、定数
ROM101に設けることにする。また、データの仮数部の桁
数64も定数ROM101に設けることにする。定数ROM101に格
納されているπ/2の値の上位桁の定数π/2(H)で、加
減算器104によりreductionを行ない剰余と商の値を求め
る。次に、剰余の仮数部のMSBより、最初の1を検出す
るための先行1検出回路102より求められた値62をシフ
ト数として、シフタ103を用いて演算結果を正規化し、
正規化された値をデータ1とする。次に処理3では定数
ROM101の仮数部の桁数64から先行1検出回路102より求
められた正規化シフト数62を加減算器104により減算し
た値2をシフト数として、定数π/2(L)を右シフトし
たものとreductionにより求められた商と乗算したもの
をデータ2とする。処理では前記データ1から前記デー
タ2を減算し正規化を行なう。このようにして、定数π
/2の値を内部では、仮想的に2倍の長さになるように設
けて演算し、reductionによる桁落ちを防いで誤差を縮
小するという方式は、第8図で求めた内部に入力数、演
算結果の2倍の長さの定数、レジスタ、ALUを設けて演
算を行なった結果と等しくなり、大幅なハードウェアを
伴わずに誤差を縮小することができるのである。
前述の実施例では三角関数の演算を行なう場合、reduct
ionによる誤差を防ぐ方式についての説明をした。しか
し、三角関数ではreductionを行なった後、商の値など
により定数π/2から剰余の値を引くという補正を行なわ
なければならない。たとえばsin Xでは、第3図で示さ
れるように商が奇数であった場合にπ/2から剰余の値を
引き算することによって補正を行ない、この補正により
第5図で示されるような誤差が生じるのである。このよ
うにreductionによる誤差以外に補正を行なうための定
数との減算による誤差も考えられるのである。
そこで、同様に三角関数sin Xを例にとって補正する時
に生じる誤差を防ぐ方法について、図を参照しながら説
明することにする。
第9図は倍精度でπ/2−Xを行なった時の式を示す図、
第10図は2倍の長さの定数π/2の値を示す図、第12図は
本発明による単精度でπ/2−Xを行なった時の式を示す
図である。
まず、本実施例では、説明を分かりやすくするために表
わし得るデータとして、仮数部64ビット長、指数部15ビ
ット長、符号1ビット長、計80ビット長の浮動小数点デ
ータをとりあげ、述べることにする。まず、π/2から剰
余の値を引き算するという補正を行なう時も同様に、第
10図で示されるように定数π/2の値を内部では、仮想的
に2倍の長さになるように上位桁をπ/2(H)として下
位桁をπ/2(L)として定数ROM101に設けることにす
る。また、データの仮数部の桁数64も定数ROM101に設け
ることにする。次に、第12図の処理5で示されるように
定数ROM101に格納されているπ/2の値の上位桁の定数π
/2(H)から剰余の値を加減算器104により引き算す
る。次に処理6では先行1検出回路102を用いてシフト
数63を求め演算結果を正規化し、正規化した値をデータ
3とする。処理7では、定数ROM101内の仮数部の桁数64
から正規化シフト数63を減算した値1をシフト数とし
て、前記定数π/2(L)をシフタ103により右シフトし
たものをデータ4とする。処理8では、前記データ3と
前記データ4を加算して正規化を行なう。このようにし
て、定数π/2の値を内部では、仮想的に2倍の長さにな
るように設けて演算し、補正による桁落ちを防いで誤差
を縮小するという方式は、第9図で求めた内部に入力
数、演算結果の2倍の長さの定数、レジスタ、ALUを設
けて演算を行なった結果と等しくなり、大幅なハードウ
ェアを伴わずに誤差を縮小することができるのである。
〔発明の効果〕
以上説明したように本発明は、浮動小数点のあらゆる関
数演算において、reductionを行なう時、またはある特
定の定数との減算を行なう時に発生する、桁落ちによる
誤差を防ぐために、定数の値を内部では、仮想的に2倍
の長さになるように設けて演算することにより、内部の
レジスタ、ALU、定数の値などを2倍にするなど大幅な
ハードウェアの増加を伴うことをせずに、第13図の誤差
グラフで示されるように高精度な演算を実行させること
ができるという効果がある。
【図面の簡単な説明】
第1図は本発明の演算方式の一実施例のブロック図、第
2図はsin Xのグラフ、第3図は三角関数sin Xのアルゴ
リズムを示す図、第4図はsin Xのreductionによる相対
誤差グラフ、第5図はsin Xの補正による相対誤差グラ
フ、第6図は単精度でX−π/2を行なった時の式を示す
図、第7図は単精度でπ/2−Xを行なった時の式を示す
図、第8図は倍精度でX−π/2を行なった時の式を示す
図、第9図は倍精度でπ/2−Xを行なった時の式を示す
図、第10図は2倍の長さの定数π/2の値を示す図、第11
図は本発明による単精度でのX−π/2を行なった時の式
を示す図、第12図は本発明による単精度でπ/2−Xを行
なった時の式を示す図、第13図は本発明により改善され
たsin Xの相対誤差グラフである。 101……定数ROM、 102……先行1検出回路、 103……シフタ、 104……加減算器。

Claims (1)

    【特許請求の範囲】
  1. 【請求項1】浮動小数点データの関数演算を行なうシス
    テムにおいて、 倍長の定数の上位桁を示す第1の定数と下位桁を示す第
    2の定数と仮数部の桁数を示す第3の定数とを格納する
    ための定数ROMと、仮数部のMSBより最初の1を検出する
    先行1検出回路と、指定された桁数だけ右シフトあるい
    は左シフト可能なシフタと、入力データの加算または減
    算を行う加減算器を有し、 入力データと定数ROMの第1の定数との減算を加減算器
    により行ない、その演算結果を第1のデータとし、第1
    のデータを先行1検出回路に入力することにより求めら
    れた値を第2のデータとし、第2のデータをシフト桁数
    として第1のデータをシフタにより左シフトした値を第
    3のデータとし、第3の定数から第2のデータを減算し
    た値を第4のデータとし、第4のデータをシフト桁数と
    して第2の定数をシフタにより右シフトした値を第5の
    データとして、第3のデータと第5のデータを加減算器
    により加算または減算することを特徴とする演算方式。
JP61259868A 1986-10-30 1986-10-30 演算方式 Expired - Lifetime JPH0772860B2 (ja)

Priority Applications (4)

Application Number Priority Date Filing Date Title
JP61259868A JPH0772860B2 (ja) 1986-10-30 1986-10-30 演算方式
DE87116006T DE3788713T2 (de) 1986-10-30 1987-10-30 Prozessor zur Berechnung von transzendenten Funktionen.
EP87116006A EP0268123B1 (en) 1986-10-30 1987-10-30 Processor for the calculation of transcendental functions
US07/114,975 US4951238A (en) 1986-10-30 1987-10-30 Processor for executing arithmetic operations on input data and constant data with a small error

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP61259868A JPH0772860B2 (ja) 1986-10-30 1986-10-30 演算方式

Publications (2)

Publication Number Publication Date
JPS63113629A JPS63113629A (ja) 1988-05-18
JPH0772860B2 true JPH0772860B2 (ja) 1995-08-02

Family

ID=17340073

Family Applications (1)

Application Number Title Priority Date Filing Date
JP61259868A Expired - Lifetime JPH0772860B2 (ja) 1986-10-30 1986-10-30 演算方式

Country Status (4)

Country Link
US (1) US4951238A (ja)
EP (1) EP0268123B1 (ja)
JP (1) JPH0772860B2 (ja)
DE (1) DE3788713T2 (ja)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5131073A (en) * 1989-07-12 1992-07-14 Ricoh Company, Ltd. Neuron unit and neuron unit network
US5222036A (en) * 1990-07-19 1993-06-22 Motorola, Inc. Device and method for evaluating trigonometric functions
EP0622727A1 (en) * 1993-04-29 1994-11-02 International Business Machines Corporation System for optimizing argument reduction
JPH07122973A (ja) * 1993-10-20 1995-05-12 Yamaha Corp デジタル信号処理回路
US6175850B1 (en) * 1997-02-03 2001-01-16 Nippon Telegraph And Telephone Corporation Scheme for carrying out modular calculations based on redundant binary calculation
US7385858B2 (en) 2005-11-30 2008-06-10 Mosaid Technologies Incorporated Semiconductor integrated circuit having low power consumption with self-refresh

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3244864A (en) * 1962-12-10 1966-04-05 Burroughs Corp Subtraction unit for a digital computer
US3997771A (en) * 1975-05-05 1976-12-14 Honeywell Inc. Apparatus and method for performing an arithmetic operation and multibit shift
US4164022A (en) * 1978-05-05 1979-08-07 Sperry Rand Corporation Electronic digital arctangent computational apparatus
US4231102A (en) * 1978-12-21 1980-10-28 Raytheon Company Cordic FFT processor
US4484259A (en) * 1980-02-13 1984-11-20 Intel Corporation Fraction bus for use in a numeric data processor
US4562553A (en) * 1984-03-19 1985-12-31 Analogic Corporation Floating point arithmetic system and method with rounding anticipation
US4777613A (en) * 1986-04-01 1988-10-11 Motorola Inc. Floating point numeric data processor

Also Published As

Publication number Publication date
EP0268123A3 (en) 1990-10-17
EP0268123B1 (en) 1994-01-05
DE3788713D1 (de) 1994-02-17
US4951238A (en) 1990-08-21
DE3788713T2 (de) 1994-04-28
EP0268123A2 (en) 1988-05-25
JPS63113629A (ja) 1988-05-18

Similar Documents

Publication Publication Date Title
EP0472148B1 (en) Method and apparatus for computing floating point data
US5197023A (en) Hardware arrangement for floating-point addition and subtraction
KR940010806B1 (ko) 연산처리 방법과 연산처리장치
US5452241A (en) System for optimizing argument reduction
JPH0319569B2 (ja)
US8060551B2 (en) Method and apparatus for integer division
US4594680A (en) Apparatus for performing quadratic convergence division in a large data processing system
EP0416308A2 (en) Rectangular array signed digit multiplier
US5278782A (en) Square root operation device
JPH0772860B2 (ja) 演算方式
US7752250B2 (en) Rounding floating point division results
JPH0540605A (ja) 浮動小数点乗算装置
US5689721A (en) Detecting overflow conditions for negative quotients in nonrestoring two's complement division
JPH0283728A (ja) 浮動小数点乗算装置
JPH04172526A (ja) 浮動小数点除算器
US5208769A (en) Unsigned integer multiply/divide circuit
US7689642B1 (en) Efficient accuracy check for Newton-Raphson divide and square-root operations
JPH0368414B2 (ja)
JP2792998B2 (ja) 加減算回路を用いた型変換装置
JPH04357522A (ja) 浮動小数点データの演算方法および演算装置
JPS6129020B2 (ja)
JP3522387B2 (ja) パイプライン演算装置
KR100431707B1 (ko) 부동소수점연산에서의지수처리방법
JPH0540609A (ja) 浮動小数点除算装置
JPH04281524A (ja) 浮動小数点演算処理装置