JP7352107B2 - Arithmetic error warning device and arithmetic error warning program - Google Patents

Arithmetic error warning device and arithmetic error warning program Download PDF

Info

Publication number
JP7352107B2
JP7352107B2 JP2021156071A JP2021156071A JP7352107B2 JP 7352107 B2 JP7352107 B2 JP 7352107B2 JP 2021156071 A JP2021156071 A JP 2021156071A JP 2021156071 A JP2021156071 A JP 2021156071A JP 7352107 B2 JP7352107 B2 JP 7352107B2
Authority
JP
Japan
Prior art keywords
error
warning
threshold
format
calculation
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.)
Active
Application number
JP2021156071A
Other languages
Japanese (ja)
Other versions
JP2023047128A (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.)
Toshiba Information Systems Japan Corp
Original Assignee
Toshiba Information Systems Japan 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 Toshiba Information Systems Japan Corp filed Critical Toshiba Information Systems Japan Corp
Priority to JP2021156071A priority Critical patent/JP7352107B2/en
Publication of JP2023047128A publication Critical patent/JP2023047128A/en
Application granted granted Critical
Publication of JP7352107B2 publication Critical patent/JP7352107B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

この発明は、演算エラー警告装置及び演算エラー警告用プログラムに関するものである。 The present invention relates to an arithmetic error warning device and an arithmetic error warning program.

コンピュータにおいて行われる演算においては、その演算における演算子の左側と右側の数値の形式が一致している必要がある。ここに、数値の形式とは、例えば単位である。例えば、長さのm(メートル)とmm(ミリメートル)を加える演算はエラーである。 In calculations performed on a computer, the formats of the numbers on the left and right sides of the operator must match. Here, the numerical format is, for example, a unit. For example, an operation that adds length m (meter) and mm (millimetre) is an error.

他には、小数点以下の分解能を表すLSB分解能情報を挙げることができる。例えば、10進数の数値「221」は、2進数で「11011101」となり、下位2bitを小数点以下と規定すると、「110111.01」=55.25を表すことができる。「下位2bitを小数点以下と規定する」は長いので、「下位2bitを小数点以下と規定する」場合には、最下位bitは0.25であるから、「221[LSB]」のように記載することで、「0.25[1/LSB]」を掛けて、221[LSB]*0.25[1/LSB]=55.25と、小数を求めることができる。恰も、「0.25」が単位のようであるので分解能を表している、と言える。 Another example is LSB resolution information representing resolution below the decimal point. For example, the decimal number "221" becomes "11011101" in binary, and if the lower 2 bits are defined as below the decimal point, "110111.01" = 55.25 can be expressed. "Define the lower 2 bits as below the decimal point" is long, so in the case of "define the lower 2 bits as below the decimal point", the lowest bit is 0.25, so write it as "221 [LSB]" By multiplying by "0.25[1/LSB]", the decimal number can be obtained as 221[LSB]*0.25[1/LSB]=55.25. Since "0.25" appears to be a unit, it can be said that it represents resolution.

「組み込み」開発などでは扱う数値は物理量であり、単位があるから例えばmVの場合には、LSBを0.25[mV/LSB]と表す。なお、上記の例では、分解能が2の冪乗の場合を例としたが、扱う対象値が物理量であるから、例えば0.77[mV/LSB]のように、2の冪乗以外も可能である。16bit符号あり整数のLSBを0.001[m/LSB]とすると、長さを-32.768m~32.767mの範囲を表現できる。また、LSBを用いる場合にも、オフセットというバイアス値を用いることが行われており、16bit符号あり整数のLSBを0.01[℃/LSB]、オフセットを-273.15℃とすると、-273.15℃~382.20℃の範囲の温度を表現可能となる。 Numerical values handled in "embedded" development etc. are physical quantities and have units, so for example, in the case of mV, the LSB is expressed as 0.25 [mV/LSB]. Note that in the above example, the resolution is a power of 2, but since the target value to be handled is a physical quantity, values other than powers of 2 are also possible, such as 0.77 [mV/LSB]. It is. If the LSB of a 16-bit signed integer is 0.001 [m/LSB], a length range of -32.768 m to 32.767 m can be expressed. Also, when using LSB, a bias value called offset is used, and if the LSB of a 16-bit signed integer is 0.01 [°C/LSB] and the offset is -273.15°C, -273 It becomes possible to express temperatures in the range of .15°C to 382.20°C.

上記のようにコンピュータにおける演算において、その演算における演算子の左側と右側の数値の形式が一致するように形式の変更を行う場合に、誤差が発生することがあり、そのまま放置すると組み込み装置を適切に動作させることができないことになる。しかしながら、現状ではこのようなソースプログラムにおける不具合については、人がチェックしており、見落としが生じる可能性がある。また、人のチェックには膨大な時間とコストが必要であり、それでも不十分であった。 As mentioned above, when performing calculations on a computer, errors may occur when changing the format so that the formats of the numbers on the left and right sides of the operator in the calculation match, and if left as is, the embedded device may This means that you will not be able to make it work. However, currently, defects in such source programs are checked by humans, and there is a possibility that they may be overlooked. In addition, human checking requires a huge amount of time and cost, which is still insufficient.

特許文献1には、データ型について変更を行うコンパイラ装置が開示されている。この引用文献1の装置では、データ型についてのものである。また、特許文献2には型変換を行うことが記載されているものの、演算の場合の型変換ではない。また、特許文献3には、不要な型変換操作の削除を行うものが開示されている。しかしながら、演算が誤差発生につながる不具合を検出するものではなく、ソースプログラムを適正なものとすることはできない。 Patent Document 1 discloses a compiler device that changes data types. The device of this cited document 1 concerns data types. Further, although Patent Document 2 describes that type conversion is performed, it is not a type conversion in the case of an operation. Further, Patent Document 3 discloses a method for deleting unnecessary type conversion operations. However, the calculation does not detect defects that lead to errors, and it is not possible to make the source program appropriate.

特開2003-150386号公報Japanese Patent Application Publication No. 2003-150386 特開2011-85967号公報Japanese Patent Application Publication No. 2011-85967 特開平5-324344号公報Japanese Patent Application Publication No. 5-324344

本発明は上記のような演算エラーに関する技術の現状に鑑みてなされたもので、その目的は、ソースプログラムにおいて演算エラーが生じる可能性のある場合に、適切な警告を発することが可能な演算エラー警告装置及び演算エラー警告用プログラムを提供することである。 The present invention has been made in view of the current state of technology regarding calculation errors as described above, and its purpose is to detect calculation errors that can issue an appropriate warning when there is a possibility that a calculation error may occur in a source program. An object of the present invention is to provide a warning device and a calculation error warning program.

本実施形態に係る演算エラー警告装置は、ソースプログラムのソースコードに含まれている演算によって数値における表現形式を変更する要チェック演算を検出する要チェック演算検出手段と、前記要チェック演算によって数値の表現形式を変更する形式変換処理を行い、更に、この形式変換処理により変更された形式変換処理結果を元に戻す形式逆変換処理を行う形式変換・逆変換処理手段と、前記形式変換・逆変換処理手段により求められた戻数値と、前記形式変換処理前の原数値との差分を誤差として求める誤差検出手段と、前記誤差と予め設定されている誤差閾値とを比較して演算エラー警告を出力するエラー警告手段とを具備することを特徴とする。


The calculation error warning device according to the present embodiment includes a check-required operation detection means for detecting a check-required operation that changes the expression format of a numerical value by an operation included in the source code of a source program; a format conversion/inverse conversion processing means that performs a format conversion process to change the expression format , and further performs a format inverse conversion process to restore the format conversion process result changed by the format conversion process; and the format conversion/inverse conversion process. Error detection means that calculates the difference between the returned value obtained by the processing means and the original value before the format conversion process as an error, and compares the error with a preset error threshold and outputs a calculation error warning. The invention is characterized by comprising an error warning means.


本発明の第1の実施形態に係る演算エラー警告装置のブロック図。FIG. 1 is a block diagram of an arithmetic error warning device according to a first embodiment of the present invention. 本発明の第1の実施形態に係る演算エラー警告装置に用いる誤差閾値の例を示す図。FIG. 3 is a diagram showing an example of an error threshold used in the calculation error warning device according to the first embodiment of the present invention. 本発明の第1の実施形態に係る演算エラー警告装置の動作を示すフローチャート。1 is a flowchart showing the operation of the arithmetic error warning device according to the first embodiment of the present invention. 本発明の第2の実施形態に係る演算エラー警告装置のブロック図。FIG. 3 is a block diagram of an arithmetic error warning device according to a second embodiment of the present invention. 本発明の第2の実施形態に係る演算エラー警告装置に用いる誤差率閾値の例を示す図。FIG. 7 is a diagram illustrating an example of an error rate threshold used in the calculation error warning device according to the second embodiment of the present invention. 本発明の第2の実施形態に係る演算エラー警告装置の動作を示すフローチャート。7 is a flowchart showing the operation of the arithmetic error warning device according to the second embodiment of the present invention.

以下添付図面を参照して、本発明の実施形態に係る演算エラー警告装置及び演算エラー警告用プログラムを説明する。各図において同一の構成要素には、同一の符号を付して重複する説明を省略する。 DESCRIPTION OF THE PREFERRED EMBODIMENTS A computation error warning device and a computation error warning program according to embodiments of the present invention will be described below with reference to the accompanying drawings. In each figure, the same components are given the same reference numerals and redundant explanations will be omitted.

図1に、本発明の第1の実施形態に係る演算エラー警告装置を示す。この実施形態に係る演算エラー警告装置は、データベース200とCPU(中央処理装置)100と、キーボード等の情報入力を行うための入力部150、情報を出力する出力手段としての表示手段300とを備えている。即ち、演算エラー警告装置は、ワークステーション、サーバ、パーソナルコンピュータ等のコンピュータ装置によって構成することができる。 FIG. 1 shows an arithmetic error warning device according to a first embodiment of the present invention. The calculation error warning device according to this embodiment includes a database 200, a CPU (central processing unit) 100, an input unit 150 such as a keyboard for inputting information, and a display unit 300 as an output unit for outputting information. ing. That is, the calculation error warning device can be configured by a computer device such as a workstation, a server, or a personal computer.

CPU100には、プログラムにより実現される各手段として、要チェック演算検出手段110、形式変換・逆変換処理手段120、誤差検出手段130、エラー警告手段140が備えられている。要チェック演算検出手段110は、例えば入力部150から入力されてCPU100へ到来するソースプログラムのソースコードを分析し、ソースプログラムのソースコードに含まれている演算によって数値における表現形式を変更する要チェック演算を検出するものである。表現形式とは、例えば、小数点以下の分解能を表すLSB分解能情報を挙げることができる。上記ソースプログラムは、図示しない記憶媒体やネットワークからデータベース200に記憶しておいたものであっても良い。 The CPU 100 is equipped with a check-required operation detection means 110, a format conversion/inverse conversion processing means 120, an error detection means 130, and an error warning means 140 as means realized by a program. The check-required operation detection means 110 analyzes the source code of a source program input from the input unit 150 and arrives at the CPU 100, and changes the expression format of a numerical value by the operation included in the source code of the source program. It detects calculations. The expression format may include, for example, LSB resolution information representing resolution below the decimal point. The source program may be stored in the database 200 from a storage medium or network (not shown).

即ち、ソースコードに含まれている演算によって数値における表現形式を変更する要チェック演算とは、例えばLSB変換とLSB逆変換によって数値における表現形式が変更されるような場合を指す。 In other words, a check-required operation in which the expression format of a numerical value is changed by an operation included in the source code refers to a case where the expression format of a numerical value is changed by, for example, LSB conversion and LSB inverse conversion.

形式変換・逆変換処理手段120は、上記要チェック演算によって数値の表現形式を変更する形式変換処理を行い、更に、この表現形式処理により変更された形式変換処理結果を元に戻す形式逆変換処理を行うものである。誤差検出手段130は、上記形式変換・逆変換処理手段120により求められた戻数値と、上記形式変換処理前の原数値との差分を誤差として求めるものである。エラー警告手段140は、上記誤差と予め設定されている誤差閾値とを比較して演算エラー警告を出力するものである。 The format conversion/inverse conversion processing means 120 performs a format conversion process to change the expression format of a numerical value by the above-mentioned check-required operation, and further performs a format inverse conversion process to restore the format conversion process result changed by this expression format process. This is what we do. The error detection means 130 determines as an error the difference between the return value obtained by the format conversion/inverse conversion processing means 120 and the original value before the format conversion processing. The error warning means 140 compares the above error with a preset error threshold and outputs a calculation error warning.

上記予め設定されている誤差閾値は、ソースプログラムのソースコードに含まれている演算毎に与えられ、データベース200の誤差閾値ファイル210に記憶されている。即ち、図2に示されるように、ソースプログラムにおける演算が記載されているアドレスと演算の演算子毎に、誤差閾値が数値で設定されている。勿論、形式の変換によって誤差が生じない数値の場合には、誤差閾値は設定されない。 The preset error threshold is given for each operation included in the source code of the source program, and is stored in the error threshold file 210 of the database 200. That is, as shown in FIG. 2, an error threshold value is set numerically for each address where an operation is described in the source program and for each operator of the operation. Of course, in the case of numerical values for which no error occurs due to format conversion, no error threshold is set.

誤差閾値は、注意喚起用の第1の誤差閾値と、この第1の誤差閾値より大きな第2の誤差閾値から構成されることができる。エラー警告手段140は、上記誤差が前記第1の誤差閾値を超え上記第2の誤差閾値の間にある場合には、注意喚起メッセージを出力し、上記誤差が上記第2の誤差閾値を超えた場合には警告メッセージを出力するように動作することができる。ここに、注意喚起メッセージは「ここの形式変換では問題はありませんが、この数値を何度か演算する場合には注意を要します。」等を例とすることができ、警告メッセージとしては「この形式変換において誤差が大きく、演算誤りを生じますので、警告致します。」等を例とすることができる。また、エラー警告手段140は、上記誤差が上記第1の誤差閾値以下の場合には、「この形式変換において問題はありません」などの適正な変換を通知するメッセージを出力するようにしても良い。これらの警告メッセージは、データベース200の警告メッセージファイル220に記憶されている。 The error threshold can be composed of a first error threshold for alerting and a second error threshold larger than the first error threshold. The error warning means 140 outputs a warning message when the error exceeds the first error threshold and is between the second error threshold and indicates that the error exceeds the second error threshold. In some cases, a warning message can be output. Here, an example of a warning message can be ``There is no problem with this format conversion, but please be careful when calculating this number several times.'', and a warning message can be `` For example, there is a large error in this format conversion, which will result in a calculation error, so we would like to warn you.''. Further, the error warning means 140 may output a message notifying appropriate conversion such as "There is no problem with this format conversion" when the error is less than or equal to the first error threshold. These warning messages are stored in the warning message file 220 of the database 200.

以上のように構成された演算エラー警告装置は、図3のフローチャートに示すように演算エラー警告を行う。例えば入力部150から入力されてCPU100へ到来するソースプログラムのソースコードを上側の行から分析し、ソースプログラムのソースコードに含まれている演算によって数値における表現形式を変更する要チェック演算を検出し(S11)、該当の演算有りかを判定する(S12)。 The arithmetic error warning device configured as described above issues an arithmetic error warning as shown in the flowchart of FIG. For example, the source code of a source program that is input from the input unit 150 and arrives at the CPU 100 is analyzed starting from the upper line, and check-required operations that change the representation format of numerical values by operations included in the source code of the source program are detected. (S11), and it is determined whether there is a corresponding calculation (S12).

上記ステップS12においてYESへ分岐すると、ステップS13へ進み、ステップS12で検出された要チェック演算によって数値の表現形式を変更する形式変換処理を行い、更に、この表現形式処理により変更された形式変換処理結果を元に戻す形式逆変換処理を行う(S13)。このステップS13の処理において、数値が物理量であり、その数値の形式が、LSB変換の場合には、形式変換処理において、論理値=(型変換)(物理量×LSB値)・・・(式1)により形式変換処理結果である論理値を得る。上記「×」は「÷」になることもある。また、形式変換処理結果を元に戻す形式逆変換処理では、次の(式2)により得られた論理値を用いて形式変換結果である物理量(元に戻した結果)を得る。物理量=(型変換)(論理値÷LSB値)・・・(式2)
上記(式2)では、上記「÷」は「×」になることもある。
When branching to YES in step S12, the process proceeds to step S13, where a format conversion process is performed to change the expression format of the numerical value based on the check-required operation detected in step S12, and further, a format conversion process changed by this expression format process is performed. A format inverse conversion process is performed to return the result to its original state (S13). In the process of step S13, if the numerical value is a physical quantity and the format of the numerical value is LSB conversion, in the format conversion process, logical value = (type conversion) (physical quantity x LSB value) (Formula 1 ) to obtain a logical value that is the result of format conversion processing. The above "x" may also become "÷". In addition, in the format inverse conversion process that returns the format conversion process result to the original format, a physical quantity (restored result) that is the format conversion result is obtained using the logical value obtained by the following (Equation 2). Physical quantity = (type conversion) (logical value ÷ LSB value)... (Formula 2)
In the above (Formula 2), the above "÷" may become "×".

上記の(式1)によって、例えば、物理量として16bit符号ありの、整数32767をLSB値0.001で論理値に変換して、その後LSB逆変換して物理量に戻す場合を例にする。物理量32767をLSB値0.001で論理値に変換すると、論理値32.767が算出される。
即ち、物理量(32767)×LSB値(0.001)=論理値(32.767)
である。
Let us take as an example a case where, for example, an integer 32767 with a 16-bit sign is converted as a physical quantity into a logical value with an LSB value of 0.001 using the above (Formula 1), and then the LSB is inversely converted to return it to a physical quantity. When the physical quantity 32767 is converted into a logical value with an LSB value of 0.001, a logical value of 32.767 is calculated.
That is, physical quantity (32767) x LSB value (0.001) = logical value (32.767)
It is.

この論理値の演算結果が32.7679となったと仮定すると、誤差を求める式は、
誤差=(論理値/LSB値)-(物理量型)(論理値/LSB値)・・・(式3)
である。
Assuming that the result of calculating this logical value is 32.7679, the formula for calculating the error is:
Error = (Logical value/LSB value) - (Physical quantity type) (Logical value/LSB value)... (Formula 3)
It is.

上記の通り、ここでは、物理量は16bit符号ありの整数の(物理量型)であるから、論理値から物理値にLSB変換した際に切り捨てられる小数点以下の値が誤差となる。
上記の例では、論理値をLSB値で割った値(論理値/LSB値)が、32.7679であるから、論理値(32.767)との差0.9が誤差となる。
As described above, since the physical quantity is a 16-bit signed integer (physical quantity type), the error is the value below the decimal point that is rounded down when LSB conversion is performed from a logical value to a physical value.
In the above example, the value obtained by dividing the logical value by the LSB value (logical value/LSB value) is 32.7679, so the difference from the logical value (32.767) of 0.9 is an error.

以上のようにして形式逆変換処理結果が得られ、誤差=(論理値/LSB値)-(物理量型)(論理値/LSB値)・・・(式3)により誤差を得る(S14)。この(式3)の「(物理量型)(論理値/LSB値)」は、形式逆変換処理される以前の物理量を求めた結果(形式逆変換処理の結果)である。 The result of the format inversion process is obtained as described above, and the error is obtained from error=(logical value/LSB value)−(physical quantity type)(logical value/LSB value) (Formula 3) (S14). “(Physical quantity type) (logical value/LSB value)” in (Formula 3) is the result of calculating the physical quantity before the format inversion processing (result of the format inversion processing).

以上のようにして誤差が求まると、誤差と予め設定されている誤差閾値とを比較してメッセージを決定し、該メッセージを表示手段300から出力する(演算エラー警告を出力する(S15))。誤差閾値が、注意喚起用の第1の誤差閾値と、この第1の誤差閾値より大きな第2の誤差閾値から構成される場合には次のように処理が行われる。即ち、上記誤差が前記第1の誤差閾値を超え上記第2の誤差閾値の間にある場合には、「ここの形式変換では問題はありませんが、この数値を何度か演算する場合には注意を要します。」等の注意喚起メッセージを出力し、上記誤差が上記第2の誤差閾値を超えた場合には「この形式変換において誤差が大きく、演算誤りを生じますので、警告致します。」等の警告メッセージを出力するように動作することができる。また、エラー警告手段140は、上記誤差が上記第1の誤差閾値以下の場合には、適正な変換を通知するメッセージを出力するようにしても良い。 When the error is determined as described above, a message is determined by comparing the error with a preset error threshold, and the message is output from the display means 300 (outputting a calculation error warning (S15)). When the error threshold is composed of a first error threshold for alerting and a second error threshold larger than the first error threshold, the following processing is performed. In other words, if the above error exceeds the first error threshold and is between the second error threshold, the message "There is no problem with this format conversion, but be careful when calculating this number several times. If the above error exceeds the second error threshold above, a warning message will be output such as ``The error in this format conversion is large and will result in a calculation error.''. ” etc. can be operated to output a warning message. Further, the error warning means 140 may output a message notifying appropriate conversion when the error is less than or equal to the first error threshold.

図4に、本発明の第2の実施形態に係る演算エラー警告装置を示す。この第2の実施形態の装置は第1の実施形態の装置の構成を備え、これに加えて、CPU100Aに誤差率算出手段160を備えているものである。誤差率算出手段160は、上記誤差検出手段130が求めた上記誤差が、上記ソースプログラムのソースコードに含まれている演算で扱っている数値(ここでは、物理値)における値範囲の最大値に対してどの程度の割合かを示す誤差率を算出するものである。この第2の実施形態では、エラー警告手段140は、上記誤差率と予め設定されている誤差率閾値とを比較して演算エラー警告を出力する。 FIG. 4 shows an arithmetic error warning device according to a second embodiment of the present invention. The apparatus of the second embodiment has the configuration of the apparatus of the first embodiment, and in addition, the CPU 100A is equipped with error rate calculation means 160. The error rate calculation means 160 determines that the error calculated by the error detection means 130 is the maximum value of the value range of the numerical values (here, physical values) handled in the calculation included in the source code of the source program. This method calculates the error rate, which indicates how much of the error rate there is. In this second embodiment, the error warning means 140 compares the error rate with a preset error rate threshold and outputs a calculation error warning.

上記予め設定されている誤差率閾値は、ソースプログラムのソースコードに含まれている演算毎に与えられ、データベース200の誤差率閾値ファイル230に記憶されている。即ち、図5に示されるように、ソースプログラムにおける演算が記載されているアドレスと演算の演算子毎に、誤差率閾値が数値で設定されている。勿論、形式の変換によって誤差が生じない数値の場合には、誤差率閾値は設定されない。 The preset error rate threshold is given for each operation included in the source code of the source program, and is stored in the error rate threshold file 230 of the database 200. That is, as shown in FIG. 5, an error rate threshold value is set numerically for each address where an operation is described in the source program and for each operator of the operation. Of course, in the case of numerical values for which no error occurs due to format conversion, no error rate threshold is set.

誤差閾値は、注意喚起用の第1の誤差閾値と、この第1の誤差閾値より大きな第2の誤差閾値から構成されることができる。エラー警告手段140は、上記誤差が前記第1の誤差閾値を超え上記第2の誤差閾値の間にある場合には、注意喚起メッセージを出力し、上記誤差が上記第2の誤差閾値を超えた場合には警告メッセージを出力するように動作することができる。ここに、注意喚起メッセージは「ここの形式変換では問題はありませんが、この数値を何度か演算する場合には注意を要します。」等を例とすることができ、警告メッセージとしては「この形式変換において誤差が大きく、演算誤りを生じますので、警告致します。」等を例とすることができる。また、エラー警告手段140は、上記誤差が上記第1の誤差閾値以下の場合には、「この形式変換において問題はありません」などの適正な変換を通知するメッセージを出力するようにしても良い。これらの警告メッセージは、データベース200の警告メッセージファイル220Aに記憶されている。 The error threshold can be composed of a first error threshold for alerting and a second error threshold larger than the first error threshold. The error warning means 140 outputs a warning message when the error exceeds the first error threshold and is between the second error threshold and indicates that the error exceeds the second error threshold. In some cases, a warning message can be output. Here, an example of a warning message can be ``There is no problem with this format conversion, but please be careful when calculating this number several times.'', and a warning message can be `` For example, there is a large error in this format conversion, which will result in a calculation error, so we would like to warn you.''. Further, the error warning means 140 may output a message notifying appropriate conversion such as "There is no problem with this format conversion" when the error is less than or equal to the first error threshold. These warning messages are stored in warning message file 220A of database 200.

以上のように構成された第2の実施形態に係る演算エラー警告装置は、図6のフローチャートに示すように演算エラー警告を行う。第2の実施形態の動作を示す図6のフローチャートは、第1の実施形態の動作を示す図3のフローチャートとほぼ同じであり、図3のステップS14の次にステップS16が挿入され、図3のステップS15がステップS15Aに変更されている。このため、以下では第1の実施形態と異なる処理を主に説明する。 The computation error warning device according to the second embodiment configured as described above issues a computation error warning as shown in the flowchart of FIG. The flowchart in FIG. 6 showing the operation of the second embodiment is almost the same as the flowchart in FIG. 3 showing the operation in the first embodiment, and step S16 is inserted after step S14 in FIG. Step S15 has been changed to step S15A. Therefore, below, processing that is different from the first embodiment will be mainly explained.

即ち、ステップS14において誤差を検出すると、次に、ステップS14において求めた上記誤差が、上記ソースプログラムのソースコードに含まれている演算で扱っている数値(ここでは、物理値)における値範囲の最大値に対してどの程度の割合かを示す誤差率を算出する(S16)。 That is, when an error is detected in step S14, next, the error determined in step S14 is within the value range of the numerical values (here, physical values) handled in the calculation included in the source code of the source program. An error rate indicating the percentage of the maximum value is calculated (S16).

例えば、上記ソースプログラムにおいて扱っている物理量(数値)の範囲が-10~10であり、得られた誤差が0.9の場合には、誤差率は9%(0.9/10)となる。また、上記ソースプログラムにおいて扱っている物理量(数値)の範囲が-100~100であり、得られた誤差が0.9の場合には、誤差率は0.9%(0.9/100)となる。このように、誤差が同じでもソースプログラムにおいて扱っている物理量(数値)の範囲が異なる場合には、誤差率は異なる。即ち、誤差率は誤差がシステムの演算全体に与える度合いを表し、誤差率が小さい(大きい)場合はシステムに与えるエラーの度合が小さい(大きい)と言える。本実施形態では、このような観点から誤差率を用いる。 For example, if the range of physical quantities (numeric values) handled in the above source program is -10 to 10 and the obtained error is 0.9, the error rate will be 9% (0.9/10). . In addition, if the range of physical quantities (numeric values) handled in the above source program is -100 to 100 and the obtained error is 0.9, the error rate is 0.9% (0.9/100) becomes. In this way, even if the error is the same, if the range of physical quantities (numeric values) handled in the source program is different, the error rate will be different. That is, the error rate represents the degree to which errors affect the overall calculations of the system, and when the error rate is small (large), it can be said that the degree of error imparted to the system is small (large). In this embodiment, the error rate is used from this viewpoint.

以上のようにして誤差率が求まると、誤差率と予め設定されている誤差率閾値とを比較してメッセージを決定し、該メッセージを表示手段300から出力する(演算エラー警告を出力する(S15A))。誤差率閾値が、注意喚起用の第1の誤差率閾値と、この第1の誤差率閾値より大きな第2の誤差率閾値から構成される場合には次のように処理が行われる。即ち、上記誤差が前記第1の誤差率閾値を超え上記第2の誤差率閾値の間にある場合には、「ここの形式変換では問題はありませんが、この数値を何度か演算する場合には注意を要します。」等の注意喚起メッセージを出力し、上記誤差が上記第2の誤差率閾値を超えた場合には「この形式変換において誤差が大きく、演算誤りを生じますので、警告致します。」等の警告メッセージを出力するように動作することができる。また、エラー警告手段140は、上記誤差が上記第1の誤差率閾値以下の場合には、適正な変換を通知するメッセージを出力するようにしても良い。 When the error rate is determined as described above, a message is determined by comparing the error rate and a preset error rate threshold, and the message is output from the display means 300 (a calculation error warning is output (S15A). )). When the error rate threshold is composed of a first error rate threshold for alerting and a second error rate threshold larger than the first error rate threshold, the following processing is performed. In other words, if the above error exceeds the first error rate threshold and is between the second error rate threshold, the message ``There is no problem with this format conversion, but if you calculate this number several times, If the above error exceeds the second error rate threshold, a warning message such as ``This format conversion has a large error and will cause a calculation error'' will be output. It can be operated to output a warning message such as ". Further, the error warning means 140 may output a message notifying appropriate conversion when the error is less than or equal to the first error rate threshold.

以上のように本実施形態によれば、演算における演算によって変数をLSB変換して論理値などの数値に変換した後に、再びLSB変換(逆LSB変換)によって元の表現形式に戻した場合に誤差が生じるケースについて、例えば、特に大きな誤差が生じる場合には確実に警告を与えてプログラムの変更を促すことができ、適正なプログラムの作成に寄与することが期待できる。 As described above, according to this embodiment, when a variable is LSB-converted into a numerical value such as a logical value by an operation in an operation and then returned to its original expression format by LSB conversion (inverse LSB conversion), an error occurs. For example, if a particularly large error occurs, a warning can be reliably given to prompt the program to be changed, and this can be expected to contribute to the creation of an appropriate program.

以上の第1の実施形態では誤差による警告メッセージを出力し、第2の実施形態では誤差率による警告メッセージを出力するようにしたが、演算エラー警告装置に双方の機能を持たせ、少なくとも一方の機能による動作を行わせるように入力部150から動作選択のコマンドを与える構成を採用しても良い。 In the first embodiment described above, a warning message based on an error is output, and in the second embodiment, a warning message based on an error rate is output. A configuration may be adopted in which an operation selection command is given from the input unit 150 so as to cause the operation to be performed according to the function.

100、100A CPU
110 要チェック演算検出手段
120 形式変換・逆変換処理手段
130 誤差検出手段
140 エラー警告手段
150 入力部
200 データベース
210 誤差閾値ファイル
220、220A 警告メッセージファイル
230 誤差率閾値ファイル
300 表示手段
100, 100A CPU
110 Check operation detection means 120 Format conversion/inverse conversion processing means 130 Error detection means 140 Error warning means 150 Input section 200 Database 210 Error threshold file 220, 220A Warning message file 230 Error rate threshold file 300 Display means

Claims (10)

ソースプログラムのソースコードに含まれている演算によって数値における表現形式を変更する要チェック演算を検出する要チェック演算検出手段と、
前記要チェック演算によって数値の表現形式を変更する形式変換処理を行い、更に、この形式変換処理により変更された形式変換処理結果を元に戻す形式逆変換処理を行う形式変換・逆変換処理手段と、
前記形式変換・逆変換処理手段により求められた戻数値と、前記形式変換処理前の原数値との差分を誤差として求める誤差検出手段と、
前記誤差と予め設定されている誤差閾値とを比較して演算エラー警告を出力するエラー警告手段と
を具備することを特徴とする演算エラー警告装置。
Check-required operation detection means for detecting a check-required operation that changes the representation format of a numerical value by an operation included in the source code of the source program;
Format conversion/inverse conversion processing means that performs a format conversion process to change the representation format of a numerical value by the check-required operation, and further performs a format inverse conversion process to restore the format conversion process result changed by the format conversion process; ,
error detection means for determining the difference between the return value obtained by the format conversion/inverse conversion processing means and the original value before the format conversion processing as an error;
An arithmetic error warning device comprising: error warning means for comparing the error with a preset error threshold and outputting an arithmetic error warning.
前記誤差閾値は、注意喚起用の第1の誤差閾値と、この第1の誤差閾値より大きな第2の誤差閾値から構成され、
前記エラー警告手段は、前記誤差が前記第1の誤差閾値を超え前記第2の誤差閾値の間にある場合には、注意喚起メッセージを出力し、前記誤差が前記第2の誤差閾値を超えた場合には警告メッセージを出力することを特徴とする請求項1に記載の演算エラー警告装置。
The error threshold includes a first error threshold for alerting and a second error threshold larger than the first error threshold,
The error warning means outputs a warning message when the error exceeds the first error threshold and is between the second error threshold, and the error warning means outputs a warning message when the error exceeds the second error threshold. 2. The arithmetic error warning device according to claim 1, wherein the arithmetic error warning device outputs a warning message if the calculation error occurs.
前記誤差が前記演算で扱っている数値における値範囲の最大値に対してどの程度の割合かを示す誤差率を算出する誤差率算出手段を備え、
前記エラー警告手段は、前記誤差率と予め設定されている誤差率閾値とを比較して演算エラー警告を出力することを特徴とする請求項1に記載の演算エラー警告装置。
comprising error rate calculation means for calculating an error rate indicating what percentage of the error is with respect to the maximum value of the value range of the numerical value handled in the calculation,
2. The calculation error warning device according to claim 1, wherein the error warning means compares the error rate with a preset error rate threshold and outputs a calculation error warning.
前記誤差率閾値は、注意喚起用の第1の誤差率閾値と、この第1の誤差率閾値より大きな第2の誤差率閾値から構成され、
前記エラー警告手段は、前記誤差率が前記第1の誤差率閾値を超え前記第2の誤差率閾値の間にある場合には、注意喚起メッセージを出力し、前記誤差率が前記第2の誤差率閾値を超えた場合には警告メッセージを出力することを特徴とする請求項3に記載の演算エラー警告装置。
The error rate threshold includes a first error rate threshold for alerting and a second error rate threshold larger than the first error rate threshold,
The error warning means outputs a warning message when the error rate exceeds the first error rate threshold and is between the second error rate threshold, and when the error rate exceeds the second error rate threshold. 4. The arithmetic error warning device according to claim 3, wherein a warning message is output when the rate threshold value is exceeded.
前記要チェック演算検出手段は、ソースプログラムのソースコードに含まれている演算における演算子の左側と右側の数値の形式である、小数点以下の分解能を表すLSB分解能情報による表現形式の変更である演算を検出することを特徴とする請求項1乃至4のいずれか1項に記載の演算エラー警告装置。 The check-required operation detection means detects an operation that is a change in the expression format using LSB resolution information representing the resolution below the decimal point, which is the format of the left and right numbers of the operator in the operation included in the source code of the source program. The arithmetic error warning device according to any one of claims 1 to 4, wherein the arithmetic error warning device detects. 演算エラー警告装置におけるコンピュータを、
ソースプログラムのソースコードに含まれている演算によって数値における表現形式を変更する要チェック演算を検出する要チェック演算検出手段、
前記要チェック演算によって数値の表現形式を変更する形式変換処理を行い、更に、この形式変換処理により変更された形式変換処理結果を元に戻す形式逆変換処理を行う形式変換・逆変換処理手段、
前記形式変換・逆変換処理手段により求められた戻数値と、前記形式変換処理前の原数値との差分を誤差として求める誤差検出手段、
前記誤差と予め設定されている誤差閾値とを比較して演算エラー警告を出力するエラー警告手段
として機能させることを特徴とする演算エラー警告用プログラム。
The computer in the arithmetic error warning device,
A check-required operation detection means for detecting a check-required operation that changes the representation format of a numerical value by an operation included in the source code of a source program;
Format conversion/inverse conversion processing means that performs a format conversion process to change the representation format of a numerical value by the check-required operation, and further performs a format inverse conversion process to restore the format conversion process result changed by the format conversion process;
error detection means for determining the difference between the return value obtained by the format conversion/inverse conversion processing means and the original value before the format conversion processing as an error;
A computation error warning program that functions as an error warning unit that compares the error with a preset error threshold and outputs a computation error warning.
前記誤差閾値は、注意喚起用の第1の誤差閾値と、この第1の誤差閾値より大きな第2の誤差閾値から構成され、
前記コンピュータを前記エラー警告手段として、前記誤差が前記第1の誤差閾値を超え前記第2の誤差閾値の間にある場合には、注意喚起メッセージを出力し、前記誤差が前記第2の誤差閾値を超えた場合には警告メッセージを出力するように機能させることを特徴とする請求項6に記載の演算エラー警告用プログラム。
The error threshold includes a first error threshold for alerting and a second error threshold larger than the first error threshold,
The computer serves as the error warning means, and when the error exceeds the first error threshold and is between the second error threshold, outputs a warning message, and outputs a warning message when the error exceeds the second error threshold. 7. The calculation error warning program according to claim 6, wherein the calculation error warning program is configured to output a warning message when the calculation error exceeds .
前記コンピュータを、前記誤差が前記演算で扱っている数値における値範囲の最大値に対してどの程度の割合かを示す誤差率を算出する誤差率算出手段として機能させ、
前記コンピュータを、前記エラー警告手段として、前記誤差率と予め設定されている誤差率閾値とを比較して演算エラー警告を出力するように機能させることを特徴とする請求項6に記載の演算エラー警告用プログラム。
causing the computer to function as an error rate calculation means for calculating an error rate indicating what percentage of the error is with respect to the maximum value of the value range of the numerical value handled in the calculation;
7. The calculation error according to claim 6, wherein the computer is operated as the error warning means to compare the error rate with a preset error rate threshold and output a calculation error warning. Warning program.
前記誤差率閾値は、注意喚起用の第1の誤差率閾値と、この第1の誤差率閾値より大きな第2の誤差率閾値から構成され、
前記コンピュータを前記エラー警告手段として、前記誤差率が前記第1の誤差率閾値を超え前記第2の誤差率閾値の間にある場合には、注意喚起メッセージを出力し、前記誤差率が前記第2の誤差率閾値を超えた場合には警告メッセージを出力するように機能させることを特徴とする請求項8に記載の演算エラー警告用プログラム
The error rate threshold includes a first error rate threshold for alerting and a second error rate threshold larger than the first error rate threshold,
The computer serves as the error warning means, and when the error rate exceeds the first error rate threshold and is between the second error rate threshold, outputs a warning message, 9. The calculation error warning program according to claim 8, wherein the program is configured to output a warning message when the error rate threshold of 2 is exceeded.
前記コンピュータを前記要チェック演算検出手段として、ソースプログラムのソースコードに含まれている演算における演算子の左側と右側の数値の形式である、小数点以下の分解能を表すLSB分解能情報による表現形式の変更である演算を検出するように機能させることを特徴とする請求項6乃至9のいずれか1項に記載の演算エラー警告用プログラム。 Using the computer as the check-required operation detection means, changing the expression format using LSB resolution information representing the resolution below the decimal point, which is the format of the numerical values on the left and right sides of the operator in the operation included in the source code of the source program. The calculation error warning program according to any one of claims 6 to 9, characterized in that the program functions to detect a calculation that is.
JP2021156071A 2021-09-24 2021-09-24 Arithmetic error warning device and arithmetic error warning program Active JP7352107B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2021156071A JP7352107B2 (en) 2021-09-24 2021-09-24 Arithmetic error warning device and arithmetic error warning program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2021156071A JP7352107B2 (en) 2021-09-24 2021-09-24 Arithmetic error warning device and arithmetic error warning program

Publications (2)

Publication Number Publication Date
JP2023047128A JP2023047128A (en) 2023-04-05
JP7352107B2 true JP7352107B2 (en) 2023-09-28

Family

ID=85778190

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2021156071A Active JP7352107B2 (en) 2021-09-24 2021-09-24 Arithmetic error warning device and arithmetic error warning program

Country Status (1)

Country Link
JP (1) JP7352107B2 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012198804A (en) 2011-03-22 2012-10-18 Denso Corp Design support device and design support program
JP2017091055A (en) 2015-11-05 2017-05-25 トヨタ自動車株式会社 Design assist device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04229324A (en) * 1990-12-27 1992-08-18 Nec Corp Generation and execution system for error evaluation program

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012198804A (en) 2011-03-22 2012-10-18 Denso Corp Design support device and design support program
JP2017091055A (en) 2015-11-05 2017-05-25 トヨタ自動車株式会社 Design assist device

Also Published As

Publication number Publication date
JP2023047128A (en) 2023-04-05

Similar Documents

Publication Publication Date Title
JP6756379B2 (en) Log analysis methods, systems and programs
Chien et al. Posit NPB: Assessing the precision improvement in HPC scientific applications
CN113778776A (en) Method and device for early warning task abnormity and storage medium
JP7352107B2 (en) Arithmetic error warning device and arithmetic error warning program
CN112380073B (en) Fault position detection method and device and readable storage medium
CN112528633A (en) Text error correction method and device, electronic equipment and computer readable storage medium
CN110825548B (en) Anomaly detection method, model training method and related device
Lim et al. RLIBM-ALL: A Novel Polynomial Approximation Method to Produce Correctly Rounded Results for Multiple Representations and Rounding Modes
CN110458713B (en) Model monitoring method, device, computer equipment and storage medium
Markstein The new IEEE-754 standard for floating point arithmetic
CN112333155B (en) Abnormal flow detection method and system, electronic equipment and storage medium
CN111310909B (en) Floating point number conversion circuit
CN115729554A (en) Formalized verification constraint solving method and related equipment
US20110270589A1 (en) Determining ill conditioning in square linear system of equations
CN112099759A (en) Numerical value processing method, device, processing equipment and computer readable storage medium
US20200125324A1 (en) Method and Apparatus for Processing Data
JP2018018197A (en) Source code evaluation program
JP6519530B2 (en) Verification apparatus, verification program, and verification method
US9619765B2 (en) Monitoring a situation by generating an overall similarity score
CN112860218A (en) Mixed precision arithmetic unit for FP16 floating point data and INT8 integer data operation
Kairalla et al. GLUMIP 2.0: SAS/IML software for planning internal pilots
CN108540137B (en) Cyclic redundancy check code generation method and device
CN111159013B (en) Code quality assessment method and device
WO2024029189A1 (en) Development support system
CN111475985B (en) Method, device and equipment for controlling size of ball mill load parameter integrated model

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20220112

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20230328

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230516

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20230815

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20230828

R150 Certificate of patent or registration of utility model

Ref document number: 7352107

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150