JPH09190335A - Cpu - Google Patents

Cpu

Info

Publication number
JPH09190335A
JPH09190335A JP8002586A JP258696A JPH09190335A JP H09190335 A JPH09190335 A JP H09190335A JP 8002586 A JP8002586 A JP 8002586A JP 258696 A JP258696 A JP 258696A JP H09190335 A JPH09190335 A JP H09190335A
Authority
JP
Japan
Prior art keywords
precision
effective
arithmetic
calculation
variable
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.)
Withdrawn
Application number
JP8002586A
Other languages
Japanese (ja)
Inventor
Shigemi Mori
繁美 森
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.)
Mitsubishi Heavy Industries Ltd
Original Assignee
Mitsubishi Heavy Industries 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 Mitsubishi Heavy Industries Ltd filed Critical Mitsubishi Heavy Industries Ltd
Priority to JP8002586A priority Critical patent/JPH09190335A/en
Publication of JPH09190335A publication Critical patent/JPH09190335A/en
Withdrawn legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide a CPU which has a calculation precision calculating function with which a user can easily recognize a part of a program where the precision may possibly be deteriorated during the execution of calculation and also in the secondary processing that is carried out after the calculation. SOLUTION: An existing double precision floating point data format is extended, and the effective digit number (VD) and the effective precision (E) of the variable value of an arithmetic result can be stored in the extended format. That is, an ALU 11 calculates the numbers (VN) and precision (E) of arithmetic variables stored in the operand register parts 12 and 13 in addition to the numerical value of those variables. Then the ALU 11 holds the calculated numbers (VN) of arithmetic variables at a register part (effective digit number part) 14c and holds the precision (E) of the variables at a register part (effective precision part) 14d respectively.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】本発明は、電子計算機に適用
されるCPUに係り、特に計算精度算定機能を備えたC
PUに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a CPU applied to an electronic computer, and more particularly to a C having a calculation accuracy calculation function.
Regarding PU.

【0002】[0002]

【従来の技術】従来、電子計算機に搭載されるCPUに
於いて、算術変数の数値データの保存は行なっている
が、算術演算後の変数の有効桁数、有効精度について
は、その変数の固有データとして保存していなかった。
図2は従来技術の概要説明図であり、ここでは図(a)
に演算の流れを示し、図(b)に変数のフォーマット例
を示している。
2. Description of the Related Art Conventionally, a CPU mounted on an electronic computer stores numerical data of arithmetic variables, but the number of significant digits and the precision of a variable after arithmetic operation are unique to that variable. It was not saved as data.
FIG. 2 is a schematic explanatory view of a conventional technique, and here, FIG.
The flow of the calculation is shown in FIG. 5, and the format example of the variable is shown in FIG.

【0003】上記したような従来の電子計算機により算
術演算を実施した場合、算術変数に対し単精度/倍精度
の計算精度管理機能はあるものの、算術演算実施時に
「丸めによる精度低下」「桁落ちによる精度低下」等が
生じた場合、精度低下が生じた箇所をユーザ側で直接知
ることができない。
When an arithmetic operation is performed by the conventional electronic computer as described above, there is a single-precision / double-precision calculation precision management function for arithmetic variables, but "precision reduction due to rounding" and "digit loss" occur when performing the arithmetic operation. However, the user cannot directly know the location where the accuracy has deteriorated.

【0004】従って、プログラム内のどの箇所で、どの
程度の精度低下が生じるのかをユーザ側で直接知ること
ができない。この精度低下を回避するために、従来で
は、ユーザが様々な特殊処置を行ない、慎重にソフトウ
ェア設計を行なっていた。
Therefore, it is not possible for the user to directly know at which point in the program and how much accuracy is reduced. In order to avoid this decrease in accuracy, conventionally, the user has taken various special measures and carefully designed the software.

【0005】このため、従来では超高精度が要求される
際の演算処理等に於いて、計算結果の精度上の信頼性
は、精度低下を回避するための特殊処置如何によって左
右されることになり、信頼性の面で問題があった。
For this reason, in the past, in the arithmetic processing when ultra-high accuracy is required, the reliability of the accuracy of the calculation result depends on the special treatment for avoiding the deterioration of accuracy. There was a problem in terms of reliability.

【0006】[0006]

【発明が解決しようとする課題】上述したように、従来
では、電子計算機により算術演算を実施した場合、算術
変数に対し単精度/倍精度の計算精度管理機能はあるも
のの、算術演算実施時に「丸めによる精度低下」「桁落
ちによる精度低下」等が生じた場合、精度低下が生じた
箇所をユーザ側で直接知ることができなかった。
As described above, conventionally, when an arithmetic operation is carried out by an electronic computer, there is a single-precision / double-precision calculation accuracy management function for arithmetic variables, but " In the case where "precision decrease due to rounding" or "precision decrease due to digit loss" occurs, it is not possible for the user to directly know the location of the precision decrease.

【0007】従って、従来ではプログラム内のどの箇所
で、どの程度の精度低下が生じるのかをユーザ側で直接
知ることができない。そこで従来では、この精度低下を
回避するために、ユーザが様々な特殊処置を行ない慎重
にソフトウェア設計を行なっているが、この処置如何に
よって精度が左右されることから、計算結果の精度上に
於ける信頼性の面で問題があった。
Therefore, conventionally, it is not possible for the user to directly know where in the program and how much the accuracy is reduced. Therefore, in the past, in order to avoid this decrease in accuracy, the user has made various special measures and carefully designed the software. However, since the accuracy depends on this measure, the accuracy of the calculation result is reduced. There was a problem in terms of reliability.

【0008】本発明は上記実情に鑑みなされたもので、
プログラム内において精度低下が生じる可能性のある箇
所を、ユーザが計算実施中及び実施後の2次処理により
容易に認識することができる、計算精度算定機能をもつ
CPUを提供することを目的とする。
The present invention has been made in view of the above circumstances,
An object of the present invention is to provide a CPU having a calculation accuracy calculation function, by which a user can easily recognize a position where accuracy may decrease in a program by secondary processing during and after calculation. .

【0009】[0009]

【課題を解決するための手段】本発明は、既存の倍精度
浮動小数点データフォーマットを拡張し、演算結果の有
効桁数や有効精度を拡張したフォーマットに記憶できる
ようにする。即ち、具体的には、ALU(算術論理部)
に於いて変数値の算術演算のみではなく、各変数が保有
する有効桁数、有効精度を合わせて計算できるようにす
る。この際の各変数は予め数値、有効桁数、有効精度を
入力するものとし、各演算に於いて演算結果の有効桁数
及び有効精度を算定し、この情報を算術変数データに付
随する情報として一緒に保存する(上書きする)。この
際の本発明に係わる概要説明図を図2に示す。尚、図2
に於いて、14cは算術変数の有効桁数(VN)を保持
する演算レジスタ部(有効桁数部)、14dは同変数の
有効精度(E)を保持する演算レジスタ部(有効精度
部)である。
SUMMARY OF THE INVENTION The present invention extends an existing double precision floating point data format so that it can be stored in a format in which the number of significant digits of a calculation result and the effective precision are extended. That is, specifically, ALU (arithmetic logic unit)
In this case, not only the arithmetic operation of the variable value but also the number of significant digits and effective precision of each variable can be calculated. For each variable at this time, enter the numerical value, the number of significant digits, and the precision in advance, calculate the number of significant digits and the precision of the calculation result in each calculation, and use this information as the information attached to the arithmetic variable data. Save (overwrite) together. FIG. 2 is a schematic explanatory diagram relating to the present invention at this time. FIG.
In the above, 14c is an arithmetic register section (effective digit section) which holds the effective digit number (VN) of the arithmetic variable, and 14d is an arithmetic register section (effective precision section) which holds the effective accuracy (E) of the same variable. is there.

【0010】[0010]

【作用】ALU(演算論理部)は、算術変数の数値のみ
ではなく、同変数の有効桁数(VN)、有効精度(E)
も計算し、既存の倍数浮動小数点の拡張フォーマット内
の指定箇所に、算術変数の有効桁数(VN)、有効精度
(E)を保存する。この有効桁数(VN)、有効精度
(E)は数値と同様に演算が行なわれる度に更新され
る。
The ALU (arithmetic logic unit) is not limited to the numerical values of arithmetic variables, but the number of significant digits (VN) and effective precision (E) of the variables.
Then, the effective digit number (VN) and the effective precision (E) of the arithmetic variable are stored in a specified place in the existing extended format of the multiple floating point. The number of effective digits (VN) and the effective precision (E) are updated every time the calculation is performed, like the numerical value.

【0011】[0011]

【発明の実施の形態】以下図面を参照して本発明の実施
形態を説明する。
Embodiments of the present invention will be described below with reference to the drawings.

【0012】図1は本発明の概要説明図であり、図中、
11はALU(演算論理部)である。このALU11
は、算術変数の数値のみではなく、同変数の有効桁数
(VN)、有効精度(E)も計算し、既存の倍数浮動小
数点の拡張フォーマット内の指定箇所に、算術変数の有
効桁数(VN)、有効精度(E)を保存する。
FIG. 1 is a schematic explanatory view of the present invention.
Reference numeral 11 is an ALU (arithmetic logic unit). This ALU11
Calculates not only the numerical value of an arithmetic variable, but also the significant digits (VN) and effective precision (E) of the same variable, and places the significant digits ( VN), effective precision (E) are saved.

【0013】12,13はALU11に入力する演算値
及び被演算値の各演算データを貯えるオペランドレジス
タ部、14は演算結果のデータを貯える演算結果レジス
タ部である。
Numerals 12 and 13 are operand register sections for storing respective operation data of operation values and operands to be inputted to the ALU 11, and 14 is an operation result register section for storing operation result data.

【0014】14cは上述した算術変数の有効桁数(V
N)を保持するレジスタ部(有効桁数部)であり、14
dは当該変数の有効精度(E)を保持するレジスタ部
(有効精度部)である。
14c is the number of significant digits (V
N) is a register unit (effective digit number part) that holds 14
d is a register unit (effective precision unit) that holds the effective precision (E) of the variable.

【0015】ALU11は、オペランドレジスタ部1
2,13に貯えられた算術変数の数値のみではなく、同
変数の有効桁数(VN)、有効精度(E)も計算する。
そして、図(b)に示すように、既存の倍数浮動小数点
の拡張フォーマット内の指定箇所に、算術変数の有効桁
数(VN)、有効精度(E)を保存する。即ち、レジス
タ部(有効桁数部)14cに算術変数の有効桁数(V
N)を保持し、レジスタ部(有効精度部)14dに当該
変数の有効精度(E)を保持する。この有効桁数(V
N)、有効精度(E)は数値と同様に演算が行なわれる
度に更新される。
The ALU 11 is an operand register unit 1
Not only the numerical values of the arithmetic variables stored in Nos. 2 and 13, but also the number of significant digits (VN) and the effective precision (E) of the variables are calculated.
Then, as shown in FIG. 7B, the effective digit number (VN) and the effective precision (E) of the arithmetic variable are stored in a specified position in the existing multiplex floating point extended format. That is, the register part (the significant digit number portion) 14c has a significant digit number (V
N) is held, and the effective precision (E) of the variable is held in the register unit (effective precision unit) 14d. This number of significant digits (V
N) and the effective precision (E) are updated every time the calculation is performed, like the numerical value.

【0016】本発明に係わる実施の形態を以下に示す2
例により説明する。
An embodiment according to the present invention will be shown below.
This will be described with an example.

【0017】実施の形態1 電子計算機のOS(オペレーティングシステム)に於い
て、変数の数値を画面上又はファイルへ出力するコマン
ドに、その変数の有効桁数、有効精度も同時に出力する
ように指定するオプションを新規に追加した場合(一例
としてC言語によるコマンドを使用する)、 ・プログラム例 printf(“Z=%VN/n”,Z) (%VN:数値出力コマンドに於いて、有効桁数、有効
精度出力を指定するオプション) 出力例 Z=3112345,VN=6,E=0.00
001 となる。この場合、ユーザは算術演算実施後の変数の有
効桁数(VN)及び有効精度(E)を画面上で視認によ
り直接確認することが可能となる。また、上記有効桁数
(VN)、有効精度(E)をファイルへ出力し、データ
の統計的処理を施すことにより、自分が設計したプログ
ラムのどの箇所で精度低下が生じ易いかを認識すること
が可能となる。
Embodiment 1 In an OS (operating system) of a computer, a command for outputting a numerical value of a variable to a screen or to a file specifies that the effective digit number and the effective precision of the variable are also output at the same time. When an option is newly added (using a command in C language as an example): Program example printf (“Z =% VN / n”, Z) (% VN: number of significant digits in numerical value output command, Option to specify effective precision output) Output example Z = 311345, VN = 6, E = 0.00
It becomes 001. In this case, the user can directly visually confirm the effective digit number (VN) and the effective precision (E) of the variable after performing the arithmetic operation on the screen. Further, by outputting the above-mentioned effective digit number (VN) and effective accuracy (E) to a file and performing statistical processing of the data, it is possible to recognize in which part of the program the user designed the accuracy deterioration easily occurs. Is possible.

【0018】実施の形態2 電子計算機のOS(オペレーティングシステム)に於い
て、返値として変数の有効桁数、有効精度を返す新規コ
マンドを追加した場合(一例としてC言語によるコマン
ドを使用する)、 ・プログラム例:変数の有効桁数が3未満の場合はエラ
ーメッセージを表示する。
Embodiment 2 In the OS (operating system) of a computer, when a new command for returning the effective digit number of a variable and effective precision is added as a return value (a command in C language is used as an example), -Program example: If the number of significant digits of the variable is less than 3, an error message is displayed.

【0019】if(VN(変数名)<3) printf(“E
rror.Check Here !”); VN(変数名):変数の有効桁数を返値とするコマンド ・プログラム例:変数の有効桁数が3未満の場合は、精
度低下の生じない他の算術ロジックへ自動的に切り替え
る。
If (VN (variable name) <3) printf ("E
rror. Check Here! )); VN (variable name): Command that returns the number of significant digits of the variable ・ Program example: If the number of significant digits of the variable is less than 3, it automatically switches to another arithmetic logic that does not reduce the precision. .

【0020】if(VN(変数名)<3) AnotherLog
ic(); AnotherLogic():精度低下を回避するための処理を
行う関数 となる。この場合、算術演算後の精度低下が発生した時
点でそれを検知してエラーメッセージを表示することが
可能となる。
If (VN (variable name) <3) AnotherLog
ic (); AnotherLogic (): This is a function that performs processing for avoiding accuracy deterioration. In this case, it is possible to detect the decrease in accuracy after the arithmetic operation and display the error message.

【0021】これによりユーザはプログラム内の精度低
下箇所を直接認識することができ、第1実施の形態と同
様の効果を得ることが可能となる。それに加えて、電子
計算機内で自動的に精度低下を回避する算術ロジックへ
切り替えることが可能となる。
As a result, the user can directly recognize the location where the accuracy is lowered in the program, and it is possible to obtain the same effect as that of the first embodiment. In addition to that, it becomes possible to automatically switch to the arithmetic logic in the electronic computer that avoids the deterioration of accuracy.

【0022】自動的に算術ロジックを切り替える機能を
付加したときは、精度低下を回避するための処理を行う
関数がライブラリ関数として電子計算機内に既に用意さ
れていれば、ユーザは算術演算実施後の変数の有効精度
低下を回避するための処置を特にプログラミングする必
要なく、自動的に精度低下を回避する演算ロジックを使
用して計算結果の信頼性を高めることが可能となる。
When a function for automatically switching the arithmetic logic is added, if a function for performing processing for avoiding a decrease in accuracy is already prepared as a library function in the electronic computer, the user can execute the arithmetic operation after the arithmetic operation. It is possible to improve the reliability of the calculation result by using the arithmetic logic that automatically avoids the accuracy deterioration without specially programming the measures for avoiding the effective accuracy deterioration of the variable.

【0023】[0023]

【発明の効果】以上詳記したように本発明によれば、プ
ログラム内に於いて精度低下が生じる可能性のある箇所
を、ユーザが計算実施中及び実施後の2次処理により容
易に認識することのできる計算精度算定機能をもつCP
Uが提供できる。
As described above in detail, according to the present invention, the user can easily recognize the location in the program where the accuracy may deteriorate by the secondary processing during and after the calculation. CP with calculation accuracy calculation function
U can provide.

【0024】本発明の具体的な効果を以下に列記する。The specific effects of the present invention are listed below.

【0025】(1)有効桁数を検知して算術ロジックを
自動的に切り替えることにより、算術演算等による計算
精度低下を極力回避することが可能となり、より信頼性
の高い計算結果を得られるようになる。
(1) By detecting the number of significant digits and automatically switching the arithmetic logic, it is possible to avoid a decrease in calculation accuracy due to arithmetic operation as much as possible, and to obtain a more reliable calculation result. become.

【0026】(2)各演算での有効桁数及び有効精度を
計算し、その内容をデータとして保存することが可能で
ある。
(2) It is possible to calculate the number of significant digits and the precision of each calculation and save the contents as data.

【0027】(3)数値計算実施後、有効桁数及び蓄積
誤差等を統計的に解析処理することにより、精度低下に
よる計算誤差を生じ易い変数及び算術計算式をユーザが
認識することが容易となる。更に、その解析結果を設計
へフィードバックすることにより、ユーザの使用目的を
満足する最適なプログラム設計を実施することが可能と
なる。
(3) After performing the numerical calculation, by statistically analyzing the number of significant digits, the accumulated error, etc., the user can easily recognize the variables and the arithmetic calculation formulas which are likely to cause the calculation error due to the deterioration of accuracy. Become. Further, by feeding back the analysis result to the design, it becomes possible to carry out the optimum program design satisfying the purpose of use of the user.

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

【図1】本発明の概要説明図。FIG. 1 is a schematic explanatory diagram of the present invention.

【図2】従来技術の概要説明図。FIG. 2 is a schematic explanatory diagram of a conventional technique.

【符号の説明】[Explanation of symbols]

11…ALU(演算論理部)、 12,13…オペランドレジスタ部、 14…演算結果レジスタ部、 14c…算術変数の有効桁数(VN)を貯えるレジスタ
部(有効桁数部)、 14d…算術変数の有効精度(E)を貯えるレジスタ部
(有効精度部)、 VN…算術変数の有効桁数、 E…算術変数の有効精度。
11 ... ALU (arithmetic logic part), 12, 13 ... Operand register part, 14 ... Operation result register part, 14c ... Register part (effective digit number part) for storing effective digit number (VN) of arithmetic variable, 14d ... Arithmetic variable Register (effective precision part) that stores the effective precision (E) of VN, effective number of digits of VN ... arithmetic variable, E ... effective precision of arithmetic variable.

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 算術演算手段と、当該手段による算術演
算実施時に生じる変数値の計算精度を表すデータを当該
変数の固有データとして保存する手段とを具備してなる
ことを特徴とするCPU。
1. A CPU comprising: an arithmetic operation means; and means for storing data representing calculation accuracy of a variable value generated when the arithmetic operation is performed by the means, as unique data of the variable.
JP8002586A 1996-01-10 1996-01-10 Cpu Withdrawn JPH09190335A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP8002586A JPH09190335A (en) 1996-01-10 1996-01-10 Cpu

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP8002586A JPH09190335A (en) 1996-01-10 1996-01-10 Cpu

Publications (1)

Publication Number Publication Date
JPH09190335A true JPH09190335A (en) 1997-07-22

Family

ID=11533489

Family Applications (1)

Application Number Title Priority Date Filing Date
JP8002586A Withdrawn JPH09190335A (en) 1996-01-10 1996-01-10 Cpu

Country Status (1)

Country Link
JP (1) JPH09190335A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007272629A (en) * 2006-03-31 2007-10-18 Casio Comput Co Ltd Calculator and calculation program
US7716267B2 (en) 2004-08-30 2010-05-11 Casio Computer Co., Ltd. Decimal computing apparatus, electronic device connectable decimal computing apparatus, arithmetic operation apparatus, arithmetic operation control apparatus, and program-recorded recording medium
JP2015232833A (en) * 2014-06-10 2015-12-24 本田技研工業株式会社 Floating-point arithmetic device, program, and arithmetic device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7716267B2 (en) 2004-08-30 2010-05-11 Casio Computer Co., Ltd. Decimal computing apparatus, electronic device connectable decimal computing apparatus, arithmetic operation apparatus, arithmetic operation control apparatus, and program-recorded recording medium
US8316067B2 (en) 2004-08-30 2012-11-20 Casio Computer Co., Ltd. Decimal computing apparatus, electronic device connectable decimal computing apparatus, arithmetic operation apparatus, arithmetic operation control apparatus, and program-recorded recording medium
JP2007272629A (en) * 2006-03-31 2007-10-18 Casio Comput Co Ltd Calculator and calculation program
JP2015232833A (en) * 2014-06-10 2015-12-24 本田技研工業株式会社 Floating-point arithmetic device, program, and arithmetic device

Similar Documents

Publication Publication Date Title
US11347511B2 (en) Floating-point scaling operation
US4338675A (en) Numeric data processor
KR950003200B1 (en) Method of and apparatus for predicting floating point
JP4953644B2 (en) System and method for a floating point unit providing feedback prior to normalization and rounding
US6571265B1 (en) Mechanism to detect IEEE underflow exceptions on speculative floating-point operations
US7137021B2 (en) Power saving in FPU with gated power based on opcodes and data
CN101443738B (en) Extract CPU time facility
JP2009093662A (en) Data processing apparatus and method for converting number between fixed-point and floating-point representations
USRE33629E (en) Numeric data processor
KR980010751A (en) Method and apparatus for performing microprocessor integer division operations using floating point hardware
JPH10207693A (en) Floating point arithmetic unit
JPS61269764A (en) Small-sized electronic computer equipped with graph displaying function
US20040039894A1 (en) Token data types in stream computers
JPH06202850A (en) Data processor
US8849881B2 (en) Modal interval processor
JPH09190335A (en) Cpu
US20070162535A1 (en) Rounding floating point division results
KR100307980B1 (en) Method and apparatus for generating less than (lt), greater than (gt), and equal to (eq) condition code bits concurrent with an arithmetic or logical operation
EP0738959A1 (en) Method and apparatus for finding arctangents
US20070124357A1 (en) Methods and apparatus fro performing calculations using reduced-width data
US5646876A (en) Method and apparatus for reducing rounding error when evaluating binary floating point polynomials
US4649478A (en) Operation code selected overflow interrupts
US20040243789A1 (en) System and method for using hardware assist functions to process multiple arbitrary sized data elements in a register
JPH02176849A (en) Electronic calculator
JP3522387B2 (en) Pipeline arithmetic unit

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20030401