JP2708526B2 - Binary integer division processing method - Google Patents

Binary integer division processing method

Info

Publication number
JP2708526B2
JP2708526B2 JP1033928A JP3392889A JP2708526B2 JP 2708526 B2 JP2708526 B2 JP 2708526B2 JP 1033928 A JP1033928 A JP 1033928A JP 3392889 A JP3392889 A JP 3392889A JP 2708526 B2 JP2708526 B2 JP 2708526B2
Authority
JP
Japan
Prior art keywords
division
divisor
significant digits
quotient
dividend
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 - Fee Related
Application number
JP1033928A
Other languages
Japanese (ja)
Other versions
JPH02212928A (en
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP1033928A priority Critical patent/JP2708526B2/en
Publication of JPH02212928A publication Critical patent/JPH02212928A/en
Application granted granted Critical
Publication of JP2708526B2 publication Critical patent/JP2708526B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は,計算機が持つ除算命令実行機構で扱う2進
整数の長さの2倍の長さを持つ被除数および除数の除算
を行う2進整数除算処理方法に関する。
DETAILED DESCRIPTION OF THE INVENTION [Industrial Application Field] The present invention relates to a binary for dividing a dividend and a divisor having a length twice as long as a binary integer handled by a division instruction execution mechanism of a computer. It relates to an integer division processing method.

計算機による科学技術計算や事務処理計算では,除算
が頻繁に用いられる。計算機で扱う数値の中で最も単純
な形式は,2進整数であるが,除算の対象となる2進整数
で表される被除数,除数について,桁数を増やすことが
望まれる。
Division is frequently used in scientific and technological calculations and paperwork calculations by computers. The simplest form of numerical values handled by the computer is a binary integer, but it is desired to increase the number of digits in the dividend and divisor represented by the binary integer to be divided.

〔従来の技術〕[Conventional technology]

従来,1語32ビットの計算機などによって実行されるFO
RTRANプログラムでは,31ビット整数型どうしの除算が可
能であるが,63ビット整数型どうしの除算は実行できな
かった。
Conventionally, a FO executed by a computer with 32 bits per word
In RTRAN programs, division between 31-bit integer types is possible, but division between 63-bit integer types cannot be performed.

〔発明が解決しようとする課題〕[Problems to be solved by the invention]

従来,FORTRANプログラム等では,63ビット整数型の除
算ができなかったため,そのような除算を行う場合に
は,例えば整数型の数値を浮動小数点に変換し,浮動小
数点命令を使用して除算を行った後,結果について整数
型に型変換を行うというような処理が必要になるという
問題があった。そのため,処理手続きが煩雑で,処理も
遅くなるという問題があった。
Conventionally, in a FORTRAN program, etc., it was not possible to divide a 63-bit integer type. To perform such a division, for example, convert an integer type number to a floating point and perform the division using a floating point instruction. After that, there is a problem that it is necessary to perform a process of performing type conversion on the result to an integer type. Therefore, there is a problem that the processing procedure is complicated and the processing is slow.

本発明は上記問題点の解決を図り,FORTRANプログラム
等における63ビット整数型の除算を,浮動小数点命令を
使用しないで実現し,かつ除算の商および余りを正確に
求める手段を提供することを目的としている。
An object of the present invention is to solve the above problems and to provide means for realizing 63-bit integer type division in a FORTRAN program or the like without using a floating-point instruction, and for accurately obtaining the quotient and remainder of the division. And

〔課題を解決するための手段〕[Means for solving the problem]

第1図は本発明の構成例を示す。 FIG. 1 shows a configuration example of the present invention.

第1図において,10はCPUおよびメモリ等からなる計算
機,P1ないしP3は計算機10による除算のための処理過程,
Xは被除数,Yは除数,d(X)は被除数Xの有効桁数,d
(Y)は除数Yの有効桁数を表す。
In FIG. 1, 10 is a computer including a CPU and a memory, etc., P1 to P3 are processing steps for division by the computer 10,
X is dividend, Y is divisor, d (X) is the number of significant digits of dividend X, d
(Y) represents the number of significant digits of the divisor Y.

計算機10は,nビットのデータを保持する複数のレジス
タを持ち,これらのレジスタに設定された2進整数の除
算命令実行機構を有する。
The computer 10 has a plurality of registers for holding n-bit data, and has a binary integer division instruction execution mechanism set in these registers.

それぞれ2nビットの範囲内で表される2進整数である
被除数Xおよび除数Yの除算を行う場合,次のような処
理過程P1〜P3によって,除算を実行する。
When dividing the dividend X and the divisor Y, each of which is a binary integer represented in the range of 2n bits, the division is performed by the following processing steps P1 to P3.

処理過程P1では,被除数Xと除数Yの有効桁数d
(X),d(Y)を求める。有効桁数は,“1"の値をとる
最も上位のビットから最下位ビットまでのビット数あ
る。また,有効桁数d(X)と有効桁数d(Y)の差d
を求める。
In the process P1, the number of significant digits d of the dividend X and the divisor Y is
(X) and d (Y) are obtained. The number of significant digits is the number of bits from the most significant bit taking the value of "1" to the least significant bit. Also, the difference d between the number of significant digits d (X) and the number of significant digits d (Y)
Ask for.

処理過程P2では,有効桁数d(X),有効桁数d
(Y)およびその差dから,次のような自明な商Zを求
める。
In the process P2, the number of significant digits d (X), the number of significant digits d
From (Y) and the difference d, the following obvious quotient Z is obtained.

d(Y)=0ならば,除算エラーである。If d (Y) = 0, it is a division error.

d(X)=0ならば,Z=0である。If d (X) = 0, then Z = 0.

d<0ならば,Z=0である。If d <0, Z = 0.

d=0ならば,Z=0または1である。If d = 0, then Z = 0 or 1.

d(Y)=1ならば、Z=Xである。If d (Y) = 1, then Z = X.

次の処理過程P2では,計算機10で行うことができるn
ビットの除算を利用して,商Zを計算するために,有効
桁数d(Y)が,n−1以下であるか,n以上であるかによ
り,場合分けを行い,n以上である場合には,被除数Xと
除数Yとをシフトして,有効桁数がnビット以下となる
値U,Vを求め,その除算により商Zを求める。そして,
逆算により,求めた商Zの補正を行う。
In the next processing step P2, n
In order to calculate the quotient Z using the division of bits, the cases are classified according to whether the number of significant digits d (Y) is less than or equal to n-1 or greater than or equal to n. , The dividend X and the divisor Y are shifted to obtain values U and V whose effective digits are n bits or less, and a quotient Z is obtained by the division. And
The obtained quotient Z is corrected by the back calculation.

〔作用〕[Action]

本発明では,1語がnビットの計算機10により,2nビッ
トの範囲内で表される被除数X,除数Yについての除算を
行うにあたって,まず,それらの有効桁数を求める。こ
の有効桁数によって,除算エラーまたは自明な商を求め
ることができる。
In the present invention, when performing a division on a dividend X and a divisor Y represented within a range of 2n bits by a computer 10 in which one word is n bits, first, the number of significant digits thereof is obtained. With this number of significant digits, a division error or a trivial quotient can be obtained.

さらに除数Yの有効桁数に着目することにより,場合
分けを行い,nビットの除数による除算命令を用いること
ができる形にして,除算を実行する。
Further, by paying attention to the number of significant digits of the divisor Y, the division is performed, and the division is executed in such a manner that a division instruction by an n-bit divisor can be used.

〔実施例〕〔Example〕

第2図は本発明の一実施例についての適用システムの
例,第3図は本発明の一実施例による処理の例,第4図
は本発明の一実施例処理フローを示す。
FIG. 2 shows an example of an application system according to one embodiment of the present invention, FIG. 3 shows an example of processing according to one embodiment of the present invention, and FIG. 4 shows a processing flow of one embodiment of the present invention.

本発明は,例えば第2図に示すようなシステムにおい
て実施される。第2図において,20はFORTRAN言語で記述
されたプログラムをコンパイルした結果のFORTRANオブ
ジェクトプログラム,21はパラメータリスト,22はライブ
ラリとして提供される63ビット除算関数ルーチンを表
す。
The present invention is implemented, for example, in a system as shown in FIG. In FIG. 2, reference numeral 20 denotes a FORTRAN object program obtained by compiling a program described in the FORTRAN language, reference numeral 21 denotes a parameter list, and reference numeral 22 denotes a 63-bit division function routine provided as a library.

従来,FORTRAN言語によるプログラムでは,63ビット整
数型どうしの除算はできず,言語仕様の制限になってい
た。本実施例では,63ビット整数型の除算が可能になっ
ており,これを行う場合,FORTRANオブジェクトプログラ
ム20は,それぞれ63ビット整数型の被除数X,除数Yおよ
び結果域からなるパラメータリスト21を作成し,あらか
じめ用意された63ビット除算関数ルーチン22を呼び出
す。
Conventionally, in a FORTRAN language program, division between 63-bit integer types has not been possible, which has been a limitation of language specifications. In this embodiment, division of a 63-bit integer type is possible, and when performing this, the FORTRAN object program 20 creates a parameter list 21 including a dividend X, a divisor Y, and a result area of a 63-bit integer type, respectively. Then, the previously prepared 63-bit division function routine 22 is called.

63ビット除算関数ルーチン22は,第1図に示すような
処理過程により,63ビット整数型の除算を実行する。そ
して,除算結果の商Zをパラメータリスト21の結果域に
設定して,呼び出し元のFORTRANオブジェクトプログラ
ム20に復帰する。
The 63-bit division function routine 22 executes a 63-bit integer type division through the processing steps shown in FIG. Then, the quotient Z of the division result is set in the result area of the parameter list 21, and the process returns to the calling FORTRAN object program 20.

例えば,第3図(a)に示すように,FORTRANオブジェ
クトプログラム20において, 「I=2147483648/2」 の除算を行うとする。
For example, as shown in FIG. 3A, it is assumed that the division of "I = 2147483648/2" is performed in the FORTRAN object program 20.

FORTRANオブジェクトプログラム20は,第3図(b)
に示すようなパラメータリスト21を作成し,その先頭ア
ドレスを所定のレジスタRegに設定して,63ビット除算関
数ルーチン22を呼び出す。
The FORTRAN object program 20 is shown in FIG.
A parameter list 21 as shown in (1) is created, the start address is set in a predetermined register Reg, and a 63-bit division function routine 22 is called.

63ビット除算関数ルーチン22で行う演算の原理は,以
下のとおりである。
The principle of the operation performed by the 63-bit division function routine 22 is as follows.

Z=X/Yを考える。ここで,X≧0,Y≧0とする。 Consider Z = X / Y. Here, it is assumed that X ≧ 0 and Y ≧ 0.

XおよびYの2進整数の有効桁数をd(X),d(Y)
とし,その差をdとする。また,Zの有効桁数をd(Z)
とする。
The significant digits of binary integers of X and Y are d (X), d (Y)
And the difference is d. The number of significant digits of Z is d (Z)
And

d=d(X)−d(Y) d≦d(Z)≦d+1である。d = d (X) −d (Y) d ≦ d (Z) ≦ d + 1.

これから,直ちに次のことがわかる。 From this, we can immediately see the following.

d(Y)=0ならば,除算エラー d(X)=0ならば,Z=0 d<0ならば,Z=0 d=0ならば,Z=0または1 d(Y)=1ならば,Z=X X=−263の場合,通常の処理では,計算機10の除算
命令(D命令,DR命令等)を使用することはできない。
そのため,X=−263の場合には,X/2をYで除算し,その
商(P)と,余り(R)の関係に従って,Zを以下のとお
りとする。
If d (Y) = 0, division error d (X) = 0, Z = 0 d <0, Z = 0 d = 0, Z = 0 or 1 d (Y) = 1 in the case of Z = X X = -2 63, the normal processing, the division instruction (D instruction, DR instructions, etc.) of the computer 10 can not be used.
Therefore, in the case of X = -2 63 divides the X / 2 in Y, and the quotient (P), according to the relationship remainder (R), be as follows Z.

R・2≧Yならば,Z=2P+1 R・2<Yならば,Z=2P 演算は,周知の除算命令(D命令またはDR命令)を用
いて行うが,これには,以下の問題がある。
If R · 2 ≧ Y, Z = 2P + 1 If R · 2 <Y, Z = 2P The operation is performed using a well-known division instruction (D instruction or DR instruction). is there.

i)結果が231以上となる場合 (桁溢れの例外が発生する。) ii)Y≧231の場合 (除数が4バイトで表現できない。) これらのことを踏まえて,次の(a),(b)のよう
に場合分けを行う。
i) Results exception of overflow if (digits is 2 31 or more is produced.) ii) In the case of Y ≧ 2 31 (divisor can not be represented by 4 bytes.) Based on these things, the following (a) , (B).

(a)d(Y)≦31の場合 この場合,除数Yが,Y<231であるから,上記(i)
の問題だけを気にすればよい。
In this case the case of (a) d (Y) ≦ 31, the divisor Y are, because it is Y <2 31, the (i)
You only have to worry about the problem.

1)d≦30の場合 この場合,d(Z)≦d+1≦31であるから,商Zは,4
バイト以内の値である。
1) When d ≦ 30 In this case, since d (Z) ≦ d + 1 ≦ 31, the quotient Z is 4
Value within bytes.

従って,Z=X/Y2を計算すればよい。Therefore, Z = X / Y2 may be calculated.

(ただし,Y2はYの下位4バイト) 2)d≧31の場合 X=X1・231+X2 (0≦X2<231) とすると, Z=X/Y=X1・231/Y+X2/Y X1=P・Y+R (0≦R<Y)とすると, Z=(P・Y+R)・231/Y+X2/Y =P・231+(R・231+X)/Y ここで,0≦R<Y,0≦X2<231から,R・231+X2<(R
+1)231≦Y・231すなわち,(R・231+X2)/Yで,
桁溢れが発生することはない。
(However, Y2 is the lower 4 bytes of Y) when the case of 2) d ≧ 31 X = X1 · 2 31 + X2 (0 ≦ X2 <2 31), Z = X / Y = X1 · 2 31 / Y + X2 / Y X1 = the P · Y + and R (0 ≦ R <Y) , Z = (P · Y + R) · 2 31 / Y + X2 / Y = P · 2 31 + (R · 2 31 + X) / Y , where, 0 ≦ R <Y, from 0 ≦ X2 <2 31, R · 2 31 + X2 <(R
+1) 2 31 ≦ Y · 2 31 words, with (R · 2 31 + X2) / Y,
No overflow occurs.

なお,X=X1・232+X2と分割した場合には,Z=P・232
+(R・232+X2)/Yとなる。ここで,もしRの先頭ビ
ットが“1"であるとすると,(R・232+X2)/Yの計算
結果が負の値になり,誤った結果となるので,このよう
な分割は行うべきではない。
In addition, when it is divided into X = X1 · 2 32 + X2, Z = P · 2 32
+ (R · 2 32 + X2) / Y. Here, if the first bit of R is “1”, the calculation result of (R · 2 32 + X2) / Y becomes a negative value, resulting in an erroneous result. is not.

(b)d(Y)≧32の場合 これが,上記(ii)の問題となる除数Yを4バイトで
表現できないケースである。
(B) Case of d (Y) ≧ 32 This is a case where the divisor Y, which is a problem of the above (ii), cannot be represented by 4 bytes.

そこで,次のようなU,Vを考える。 Therefore, the following U and V are considered.

U=[X/2d(Y)-31] V=[Y/2d(Y)-31]とする。U = [X / 2 d (Y) -31 ] V = [Y / 2 d (Y) -31 ].

U≦X/2d(Y)-31<U+1, V≦Y/2d(Y)-31<V+1であるから, U=P・V+R (0≦R<V)とすると, ここで,R<Vであるから, 従って,上記式は, となる。Since U ≦ X / 2 d (Y) −31 <U + 1, V ≦ Y / 2 d (Y) −31 <V + 1, Assuming that U = P · V + R (0 ≦ R <V), Here, since R <V, Therefore, the above equation is Becomes

1)P≦Rの場合 となるから, Z=[X/Y]=P 2)P>Rの場合 ここで,2d(Y)-1≦Y<2d(Y)より, 230≦V=[Y/2d(Y)-31]<231 260≦V2<262 一方,U=[X/2d(Y)-31] =[X/2d(X)-d-31] =[X・2d+31/2d(x)]より, 2d+30≦U<2d+31 従って,U/V2<2d+31/260=2d-29 以上から, P−2d-29<P−(P−R)/(X+1) <X/Y d=d(X)−d(Y)≦32(∵d(X)≦64,d(Y)
≧32) から, d≦29ならば,P−1≦Z≦P d=30ならば,P−2≦Z≦P d=31ならば,P−4≦Z≦P d=32ならば,P−8≦Z≦P すなわち, (1)d≦29の場合 X<P・Yならば,Z=P−1 X≧P・Yならば,X=P (2)d=30の場合 X<(P−1)・Yならば, Z=P−2 (P−1)・Y≦X<P・Yならば,Z=P−1 P・Y ≦Xならば, Z=P (3)d=31の場合 X<(P−3)・Yならば, Z=P−4 (P−3)・Y≦X<(P−2)・Y ならば, Z=P−3 (P−2)・Y≦X<(P−1)・Y ならば, Z=P−2 (P−1)・Y≦X<P・Yならば,Z=P−1 P・Y≦Xならば, Z=P (4)d=32の場合 これは,X=−263の場合であり,すでに考慮済みであ
る。
1) When P ≦ R Z = [X / Y] = P 2) When P> R Here, from 2 d (Y) -1 ≦ Y <2 d (Y), 2 30 ≦ V = [Y / 2 d (Y) -31] <2 31 2 60 ≦ V 2 <2 62 Meanwhile, U = [X / 2d (Y) -31 ] = [X / 2d (X) -d-31 ] = [X · 2d + 31 / 2d (x) ], 2d + 30 ≦ U < 2 d + 31 Therefore, from U / V 2 <2 d + 31/260 = 2 d-29 or more, P−2 d−29 <P− (P−R) / (X + 1) <X / Y d = d (X) −d (Y) ≦ 32 (∵d (X) ≦ 64, d (Y)
≧ 32) From d ≦ 29, if P−1 ≦ Z ≦ Pd = 30, if P−2 ≦ Z ≦ Pd = 31, if P−4 ≦ Z ≦ Pd = 32, then P−8 ≦ Z ≦ P That is, (1) When d ≦ 29 If X <P · Y, then Z = P−1 If X ≧ P · Y, then X = P (2) If d = 30 X If <(P-1) .Y, then Z = P-2 (P-1) .Y≤X <P.Y, if Z = P-1 P.Y ≤X, then Z = P (3 ) When d = 31 If X <(P−3) · Y, then Z = P−4 (P−3) · Y ≦ X <(P−2) · Y If Z = P−3 (P -2) · Y ≦ X <(P-1) · Y, then Z = P-2 (P-1) · Y ≦ X <P · Y, Z = P-1 if P · Y ≦ X If, in this case of Z = P (4) d = 32, a case of X = -2 63, is already considered already.

以上の演算の原理を利用して,63ビット整数型の除算
を,第4図に示す処理フローのように行う。以下,第4
図に示す処理〜に従って説明する。
Utilizing the above-described operation principle, 63-bit integer type division is performed as in the processing flow shown in FIG. Hereinafter, the fourth
The processing will be described according to the processing shown in FIG.

変数DXに被除数Xの有効桁数,変数DYに除数Yの有効
桁数を入れる。変数DにDXとDYの差を入れる。
The number of significant digits of the dividend X is entered in the variable DX, and the number of significant digits of the divisor Y is entered in the variable DY. Put the difference between DX and DY in variable D.

DY=0のとき,除算エラーとする。When DY = 0, a division error occurs.

有効桁数DX,DYおよびその差Dに従って,自明な商Z
を求める。
A trivial quotient Z according to the number of significant digits DX and DY and the difference D
Ask for.

X=−263の場合,すなわち, X=−2147483648の場合, Pに(X/2)/Yの商を入れ, Rに(X/2)/Yの余りを入れる。For X = -2 63, i.e., the case of X = -2147483648, putting the quotient of (X / 2) / Y to P, put the remainder of (X / 2) / Y in R.

R*2<Yならば,Z=P*2 R*2≧Yならば,Z=P*2+1とする。 If R * 2 <Y, Z = P * 2. If R * 2 ≧ Y, Z = P * 2 + 1.

DY≦31の場合, Y2にYの下位32ビットを入れて,以下の処理,を
行う。
When DY ≦ 31, the lower 32 bits of Y are put in Y2 and the following processing is performed.

D≦31であれば,Z=X/Y2とする。If D ≦ 31, Z = X / Y2.

・X1にXの上位33ビットを入れる。• Put the upper 33 bits of X into X1.

・X2にXの下位31ビットを入れる。・ Put the lower 31 bits of X into X2.

・ZにX1/Y2を入れる。・ Put X1 / Y2 in Z.

・Zを左に31ビットシフトする。Shift Z 31 bits to the left.

・ZにX2/Y2を加えて,求める商とする。• Add X2 / Y2 to Z to obtain the desired quotient.

DY>31の場合,以下の処理を行う。If DY> 31, the following processing is performed.

・Xを右に(DY-31)ビットシフトしたものをUに入れ
る。
• Put X's right (DY-31) bit shifted into U's.

・Yを右に(DY-31)ビットシフトしたものをVに入れ
る。
• Put the result of shifting Y to the right (DY-31) bits into V.

・ZにU/Vの商を入れる。これをPとする。・ Enter the quotient of U / V in Z. This is P.

・RにX−P*Yを入れる。・ Put X-P * Y in R.

・次にR<0の間,Zから1を引き,RにYを足す処理を繰
り返す。
Next, while R <0, the process of subtracting 1 from Z and adding Y to R is repeated.

Rが0または正の数になったならば, そのときのZの値を,求める商とする。 If R becomes 0 or a positive number, the value of Z at that time is the quotient to be obtained.

〔発明の効果〕〔The invention's effect〕

以上説明したように,本発明によれば,例えば1語が
32ビットの計算機上で,63ビット整数型の除算を浮動小
数点命令を使用しないで実現できるようになり,FORTRAN
言語等における仕様制限を緩和することができるように
なる。従って,応用プログラムにおける計算精度を向上
させるとともに,処理負担を軽減することが可能にな
る。
As described above, according to the present invention, for example, one word is
On 32-bit computers, 63-bit integer division can be performed without using floating-point instructions.
This makes it possible to relax specification restrictions in languages and the like. Therefore, the calculation accuracy of the application program can be improved, and the processing load can be reduced.

【図面の簡単な説明】[Brief description of the drawings]

第1図は本発明の構成例 第2図は本発明の一実施例についての適用システムの
例, 第3図は本発明の一実施例による処理の例, 第4図は本発明の一実施例処理フローを示す。 図中,10は計算機,P1〜P3は処理過程,Xは被除数,Yは除数
を表す。
Fig. 1 is an example of the configuration of the present invention. Fig. 2 is an example of an application system according to an embodiment of the present invention. Fig. 3 is an example of processing according to an embodiment of the present invention. Fig. 4 is an embodiment of the present invention. 4 shows an example processing flow. In the figure, 10 is a computer, P1 to P3 are processing steps, X is a dividend, and Y is a divisor.

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】nビットの2進整数で除算する除算命令実
行機構を有する計算機を用いて,被除数と除数がそれぞ
れ2nビットの範囲内で表される2進整数の除算の商およ
び余りの計算処理をソフトウェアによって行う2進整数
除算処理方法であって, 被除数Xおよび除数Yの2進整数の有効桁数を求める処
理過程と, 被除数Xと除数Yの有効桁数およびその有効桁数の差に
より,自明な除算の答えを求める処理過程と, 除数Yの有効桁数が,n−1以下であるか,n以上であるか
により,場合分けを行い,n−1以下である場合には,上
記除算命令実行機構により除算の答えを求め,n以上であ
る場合に,被除数Xと除数Yとをシフトして,有効桁数
がnビット以下となる値をそれぞれ求め,該求めた値を
用いて上記除算命令実行機構で除算を行い,被除数Xか
ら,上記求めた商と除数Yとの積を減じた値である余り
が負である間は,求めた商を1減じて,余りの値に除数
Yを加えることを繰り返すことで,除算の商および余り
を求める処理過程とを備えた ことを特徴とする2進整数除算処理方法。
1. Calculation of a quotient and a remainder of a division of a binary integer in which a dividend and a divisor are each represented in a range of 2n bits using a computer having a division instruction execution mechanism for dividing by an n-bit binary integer. A binary integer division processing method in which processing is performed by software, the process of obtaining the number of significant digits of a binary integer of a dividend X and a divisor Y, and the difference between the number of significant digits of the dividend X and the divisor Y and the number of significant digits. Divides the case according to the process of finding the answer of the trivial division and whether the number of significant digits of the divisor Y is less than or equal to n-1 or greater than or equal to n. The answer of the division is obtained by the above-mentioned division instruction execution mechanism. If the answer is not less than n, the dividend X and the divisor Y are shifted to obtain values each having the number of significant digits of n bits or less. Is divided by the above division instruction execution mechanism using As long as the remainder, which is the value obtained by subtracting the product of the quotient and the divisor Y obtained from the number X, is negative, the obtained quotient is reduced by 1 and the divisor Y is added to the remainder, thereby repeating the above. A binary integer division processing method, comprising: a process of obtaining a quotient and a remainder of division.
JP1033928A 1989-02-14 1989-02-14 Binary integer division processing method Expired - Fee Related JP2708526B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1033928A JP2708526B2 (en) 1989-02-14 1989-02-14 Binary integer division processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1033928A JP2708526B2 (en) 1989-02-14 1989-02-14 Binary integer division processing method

Publications (2)

Publication Number Publication Date
JPH02212928A JPH02212928A (en) 1990-08-24
JP2708526B2 true JP2708526B2 (en) 1998-02-04

Family

ID=12400180

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1033928A Expired - Fee Related JP2708526B2 (en) 1989-02-14 1989-02-14 Binary integer division processing method

Country Status (1)

Country Link
JP (1) JP2708526B2 (en)

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62175825A (en) * 1986-01-29 1987-08-01 Fuji Electric Co Ltd Division system for control real time arithmetic
JP2605715B2 (en) * 1987-05-11 1997-04-30 松下電器産業株式会社 Division circuit

Also Published As

Publication number Publication date
JPH02212928A (en) 1990-08-24

Similar Documents

Publication Publication Date Title
KR100289513B1 (en) Calculation device and calculation and accumulation device of population count
US7644115B2 (en) System and methods for large-radix computer processing
US5341320A (en) Method for rapidly processing floating-point operations which involve exceptions
US4594680A (en) Apparatus for performing quadratic convergence division in a large data processing system
Magenheimer et al. Integer multiplication and division on the HP precision architecture
US8856759B2 (en) Method and apparatus providing COBOL decimal type arithmetic functions with improved performance
US10180826B2 (en) Estimation of bit widths of variables based on liveness
Buell et al. A multiprecise integer arithmetic package
US7647368B2 (en) Data processing apparatus and method for performing data processing operations on floating point data elements
JP2708526B2 (en) Binary integer division processing method
US20090083507A1 (en) Shift-add mechanism
EP0594969A1 (en) Data processing system and method for calculating the sum of a base plus offset
US20040117423A1 (en) Signed integer long division apparatus and methods for use with processors
US5661674A (en) Divide to integer
JP2583599B2 (en) Binary integer multiplication processing method
KR100887327B1 (en) Method, Programming Structure and Recordable Medium for Performing Fast Floating Point Operation for Various Precisions
EP0257650B1 (en) Microprocessor
EP0166999A2 (en) Time saving method for computing square roots on a computer having a &#34;one bit at a time&#34; division instruction
JP4712247B2 (en) Microprocessor development system for application programs involving integer division or integer remainder
EP1091292B1 (en) A method for translating a source operation to a target operation, and computer program for the method
Hass Synthesizing optimal fixed-point arithmetic for embedded signal processing
US7051062B2 (en) Apparatus and method for adding multiple-bit binary-strings
RU2276805C2 (en) Method and device for separating integer and fractional components from floating point data
US7237000B2 (en) Speed of execution of a conditional subtract instruction and increasing the range of operands over which the instruction would be performed correctly
Beebe Accurate square root computation

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees