Numerical program floating point error detection method and device based on chain condition guidance
Through the numerical program floating point error detection method based on chain condition guidance, the problems of high false alarm rate, high calculation overhead and high cost in the prior art are solved, and the inputs that trigger high floating point errors are quickly and accurately detected. Improve detection efficiency and accuracy.
Patent Information
- Application Number
- CN202411552245.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-02-18
AI Technical Summary
The prior art has problems with high false alarm rate, high calculation overhead and high cost in detecting inputs that trigger high floating point errors, and it is difficult to effectively identify inputs that lead to major floating point errors.
Using a numerical program floating-point error detection method based on chain condition guidance, the maximum chain conditional error detection method can be generated by dividing the input domain into multiple sub-intervals and performing a heuristic search of chain conditional number guidance for each sub-interval. Input of the number, perform reverse error tracking to identify floating point operations that introduce high chain conditional numbers.
It realizes rapid and accurate detection of inputs that trigger large floating point errors, reduces false alarm rates, improves detection efficiency and accuracy, reduces costs, and has strong method stability.
Smart Images

Figure CN119473860A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of numerical program error detection, and in particular to a numerical program floating point error detection method and device based on chain condition guidance. Background Art
[0002] Floating-point numbers use a finite number of bits to represent real numbers, so floating-point calculations are subject to rounding errors, and these errors can propagate and accumulate, producing unacceptable results. Detecting inputs that can trigger large floating-point errors is critical to improving the reliability of numerical programs. In addition to testing, such error-inducing inputs can also be used to locate precision loss, improve accuracy, optimize precision configuration, etc. However, only a small portion of the input space in the input domain can trigger large floating-point errors, and theoretical reasoning about the propagation of rounding errors is non-intuitive, so generating inputs that can trigger high floating-point errors remains challenging.
[0003] In order to detect inputs that trigger high floating-point errors, the prior art usually uses heuristic searches to identify inputs that cause errors, such as binary searches, condition number-guided searches, and searches based on genetic algorithms, or attributes the problem of generating erroneous inputs to a code coverage problem and solves it through symbolic execution. However, the above methods need to rely heavily on test oracles generated by high-precision execution, which requires expert knowledge to handle operations of specific precision, which is not only costly but also significantly increases computational overhead. The ATOMU method performs atomic condition-guided searches to find inputs that cause floating-point errors, and is independent of high-precision calculations (no test oracles). Although this type of method can effectively identify inputs that may cause major floating-point errors, it is prone to false positives because it only focuses on single floating-point operations. Summary of the invention
[0004] The technical problem to be solved by the present invention is: in response to the technical problems existing in the prior art, the present invention provides a floating-point error detection method and device for numerical programs based on chain condition guidance, which is simple to implement, low in cost, has high detection efficiency, high precision and strong stability, and can quickly and accurately detect inputs that trigger large floating-point errors, thereby improving the reliability of numerical programs.
[0005] In order to solve the above technical problems, the technical solution proposed by the present invention is:
[0006] A method for detecting floating-point errors in numerical programs based on chained conditional guidance, comprising the following steps:
[0007] Step S1: Input domain partitioning: Obtain the numerical program P(x) to be tested, and divide the input domain I of the numerical program P(x) to be tested into multiple sub-intervals I s ={i1, i2, ..., in}, n represents the number of sub-intervals;
[0008] Step S2: Chain condition guided search: Perform a heuristic search based on the chain condition number for each subinterval i, record the input that can generate the maximum chain condition number for each subinterval, sort all recorded inputs from high to low according to the generated chain condition number, and obtain the input list X = {x0, x1, ..., x k} and the maximum number of chained conditions;
[0009] Step S3: backward error location: perform reverse error tracking on the searched maximum chain condition number to identify floating point operations that introduce high chain condition numbers, where the high chain condition number is a chain condition number that exceeds a preset threshold.
[0010] Furthermore, in step S1, the input domain I is divided into multiple sub-intervals using a non-uniform partitioning method based on the floating point number distribution density. max to f max The program, f max ≈2 1024 , the positive subinterval of floating point numbers i∈I s And satisfy:
[0011]
[0012] Further, step S2 includes:
[0013] Step S201. Direct search: Use a direct search algorithm for each subinterval i to obtain the input x that can trigger the maximum chain condition number for each interval i. i , record x i and its corresponding chain condition number cc i To the collection TempCC l In descending order of chain condition number, the set TempCC l Sort by
[0014] Step S202. Line search: Use line search to sort the set TempCC l Refine sampling near the first limit inputs in , in order to try to obtain inputs that can trigger a larger number of chain conditions, and determine the input x that triggers a high number of chain conditions obtained by line search k If you input x k If the corresponding condition number is greater than the preset chain condition number threshold, then (x k ,cc k) is added to the list CC1, and the elements in the list CC1 are sorted in descending order according to the chain condition number to obtain the input list X={x0, x1, ..., x k}.
[0015] Furthermore, it also includes constructing a propagation calculation rule of a chain condition number for calculating the chain condition number generated by a given input, wherein the propagation calculation rule of the chain condition number is:
[0016]
[0017] Among them, op i →op j means op i The output of op j Input, Indicates operation op j the atomic condition number for the input parameter x, represents the sum of input atomic conditions. Rules Init-1 and Init-2 describe the calculation of the chain condition number of the initial statement. The chain condition number of the initial statement of a single-element operation is the condition number of the operation itself, and the chain condition number of the initial statement of a double-element operation is the sum of the condition numbers of the two operands corresponding to the operation. Given an operation sequence seq=<y=op1(x1,x2);z=op2(y)> , since op2 is a single-element operation, the rule Unary captures how the input floating-point error is amplified by seq, that is, the chain condition number at operation op1 is multiplied by the condition number of operation op2; given an operation sequence seq =<x=op1(x1,x2);z=op2(x,y)> And there is no incoming operation that calculates operand y. The rule Binary-1 captures how the floating-point error is amplified by seq, that is, the chained condition number at operation op1 multiplied by the condition number of op2 for parameter x plus the condition number of op2 for parameter y. Given an operation sequence seq =<m1=op1(x1,x2);m2=op2(y1,y2);z=op3(m1,m2)> , capturing how the input floating-point error is amplified by seq through the rule Binary-2, which is the chained condition number at operation op1 multiplied by the condition number of op2 for parameter x plus the chained condition number at op1 multiplied by the condition number of op2 for parameter y.
[0018] Furthermore, the operation sequence Seq = {st0, ..., st n}, n≥0, scan the statements in sequence, and calculate the chain condition number generated by the program P(x) executing the input x based on the calculation propagation rule of the chain condition number according to the operation type of the statement and the dependent statement of the input parameter.
[0019] Further, step S03 includes:
[0020] For a given error trigger input x, extract the runtime information about all instructions in the numerical program P(x) under test and generate an instruction sequence Seq = {st0, ..., st n};
[0021] Store localized source code, use the function GetPredecors(st n )Get the statement st in Seq n The predecessor statement, if the predecessor statement st i The chain condition number CC(st i )>CC(st n ) / w, where w is a user-defined constant greater than 1, the preceding statement st i Add to the problem statement set SubSeq;
[0022] Returns the localized source code stored in SubSeq.
[0023] A computer device comprises a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to execute the computer program to perform the above-mentioned numerical program floating point error detection method based on chain condition guidance.
[0024] A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the floating-point error detection method for numerical programs based on chain condition guidance as described above is implemented.
[0025] A computer program product includes computer instructions, which are executed by a processor to enable a computer device to implement the above-mentioned numerical program floating-point error detection method based on chain condition guidance.
[0026] Compared with the prior art, the advantages of the present invention are: the present invention guides the search through chained condition numbers to trigger inputs of high floating-point errors, and utilizes chained condition numbers to accurately reflect the cumulative propagation process of error propagation, which can not only reduce false alarms but also improve the efficiency of detecting high floating-point errors in numerical programs. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a schematic diagram of the implementation flow of the numerical program floating-point error detection method guided by chain conditions in this embodiment.
[0028] Figure 2 3 is a schematic diagram of the distribution results of the chain condition number and the ULP error corresponding to the input obtained in this embodiment.
[0029] Figure 3 Schematic diagram of the error tracking principle of the example code P2 in this embodiment.
[0030] Figure 4 1 is a schematic diagram showing the comparison results of the number of error trigger inputs Log2(N) detected per second by the traditional ATOMU and the FPCC of the present invention in a specific embodiment.
[0031] Figure 5 It is the log2 value of the number of error triggering inputs of each function detected by the FPCC of the present invention and the traditional ATOMU in 100 runs obtained in the specific application embodiment.
[0032] Figure 6 It is a schematic diagram of the ULP error results of the first-level input of each function detected by the FPCC of the present invention and the traditional ATOMU in 100 runs obtained in a specific application embodiment. DETAILED DESCRIPTION
[0033] The present invention is further described below in conjunction with the accompanying drawings and specific preferred embodiments, but the protection scope of the present invention is not limited thereby.
[0034] For ease of understanding, the relevant technical background of the present invention is first introduced by way of example.
[0035] 1. Floating point format
[0036] Modern computers use floating point numbers to approximate real numbers. In IEEE 754, floating point numbers can be represented as follows:
[0037] (-1) s ×M×2 E
[0038] A floating point number consists of three parts: a 1-bit sign S (S∈{0,1}), an n-bit valid number M (M=m0,m1,m2…m n , m0 is the hidden bit) and p-bit bias index E (E = e-(2 p-1 When all exponent bits are 1, the floating point represents a special value ie, ±∞ or NaN (Not a Number).
[0039] 2. Floating point error measurement
[0040] Since floating-point numbers use a limited number of bits to represent real numbers, they can only represent a subset of real numbers. When a real number cannot be accurately encoded, the IEEE 754 standard provides different rounding modes (such as rounding to the nearest) to convert a real number to a nearby floating-point number. Let R and F represent real numbers and floating-point numbers, respectively. Given a real number x∈R, and let x f ∈F represents its floating point representation, then the rounding error is xxf .
[0041] Absolute error and relative error are two common metrics for measuring floating-point errors. Given a floating-point program f and an input x, use to represent the ideal mathematical result of program f. Absolute error and relative error The definition is as follows:
[0042]
[0043] ULP(x) describes the distance between two consecutive floating-point numbers closest to x. The ULP error can be used to measure the floating-point error, which is defined as follows:
[0044]
[0045] 3. Condition number
[0046] The condition number of a function measures its sensitivity to small perturbations of its input. The condition number depends on the function and the input, but is independent of the implementation. Assuming that the input x carries a small error Δx, according to the Taylor expansion, we have:
[0047]
[0048] According to equation (3), it is obvious that f(x+Δx)-f(x)≈f′(x)Δx, so the relative error between f(x+Δx) and f(x) can be defined as:
[0049]
[0050] The condition number is defined as follows:
[0051]
[0052] Obviously, the condition number reflects the extent to which the input relative error |Δx / x| is amplified in the output relative error.
[0053] Given a floating-point program f, it is not easy to obtain f′(x) unless its mathematical function is given in advance. The most advanced method ATOMU introduces atomic condition numbers to characterize the error amplification of a single atomic floating-point operation. Atomic operations can be arithmetic (+, -, ×÷) or basic functions (such as sin and cos). ATOMU uses atomic conditions to guide the search for inputs that cause errors. For example, given an operation op(x, y) = x+y, and In other words, when x≈-y, the operation x+y may introduce a large floating point error, i.e., catastrophic cancellation. And ATOMU only focuses on a single floating point operation, which is prone to false positives. For example, for a given function foo, when the above method is used to search for inputs that cause errors, since the input can trigger the atomic condition in the unstable subtraction 1.0-a , calculate a=3.0 / (x*x) to get a=1.00000000000000004, and the subtraction "(1.0-a)=-4.440892098500626e-16" introduces an absolute error around 7.1819e-17, which is relatively large compared to -4.440892098500626e-16. However, the absolute error 7.1819e-17 is less than the machine error of 1.0 (about 2.22e-16) and is suppressed by the last operation "B+1.0", resulting in a very small final relative error, and ultimately reporting an erroneous input "x=1.7320508075688770", which is a false positive. Experiments have shown that the above-mentioned traditional ATOMU method can actually only trigger significant floating-point errors in 19.45%.
[0054] Considering that a numerical program can be regarded as a series of arithmetic operations, the interaction of consecutive condition numbers can capture the propagation process of floating-point errors. The present invention detects inputs that cause errors by adopting a test-free oracle search guided by a chained condition number. Different from the condition number of an atomic condition that only considers a single floating-point operation, the chained condition number focuses on the transmission process of the condition number. The chained condition number can reflect how a series of floating-point operations amplify input errors, so that the chained condition number can effectively avoid false positives.
[0055] For example, function foo:
[0056]
[0057] For the same given input x, the chained condition number of the returned value is 5.0, which means that the value is small, indicating that the result does not contain significant errors, from which it can be seen that the chained condition number can help prevent false positives.
[0058] The following code snippet from a real-world numerical program from the GSL scientific library is used as an example to illustrate how atomic operations can introduce false positives, and the effectiveness of using chained condition numbers to address this problem.
[0059] The program P1(x) shown in Table 1 comes from the GSL function gsl_sf_airy_Ai (line 680 in gsl / specfunc / airy,c), where a and b come from the previous Chebyshev polynomial operation and are treated as constants. Program P2(x) is a variant of P1(x), replacing the last floating-point addition in P1(x) with a multiplication operation, specifically: P1(x)=0.375+(ax*(0.25+b), P2(x)=0.375*(ax*(0.25+b). The specific value of x used is -7.7274027910331625e-2. Using the traditional ATOMU method, this value will be identified as the input most likely to trigger a significant floating-point error (i.e., a relative error greater than 1e-3). Each program can be viewed as a sequence of five floating-point operations. Table 1 shows the operands, chain condition number, atomic condition, operation results, and relative errors of the five operations. The atomic condition is calculated by the ATOMU method, and the chain condition number is calculated using the propagation rule defined in the present invention.
[0060] Table 1: An example of motivation for error propagation with manipulation
[0061]
[0062] op1: v1 = 0.25 + b
[0063] - Chain conditions:
[0064] -Atomic conditions:
[0065] -Relative error: 1.01×10-16, the error is introduced by + operation, less than 0.5ULP.
[0066] op2: v2 = x * v1
[0067] - Chain condition: CC(U2)=C*(x)+CC(U1)*C*(U1)=1.0+1.0=2.0
[0068] -Atomic conditions: C(U2)≈2.0
[0069] -Relative error: 1.86×10-16, the error is slightly magnified by C(U2).
[0070] op3: v3 = a - v2
[0071] - Chain conditions:
[0072] -Atomic conditions:
[0073] -Relative error: 3.49×10-1, which is further amplified by C(U3).
[0074] op4: v4 = 0.375 + v3
[0075] - Chain conditions:
[0076] -Atomic conditions:
[0077] -Relative error: 2.84×10-17 is the absolute error introduced by v3, which is about 2.42e-18, which is significantly smaller than the first operand 0.375 and can be ignored. Therefore, the error of the calculated result P1(x) can be ignored.
[0078] OP 5: v5 = 0.375 * v3
[0079] - Chain condition: CC(U5)=C*(0.375)+CC(U3)*C*(U3)≈8.64e+15
[0080] -Atomic conditions: C(U5)≈2.0
[0081] -Relative error: 3.49×10-1, the error of U3 propagates to U 5, which is consistent with the final chain condition value of 8.65e+15.
[0082] The above examples show that 1. Large atomic conditions may cause significant relative errors in atomic operations. However, such errors may not propagate to the final result, such as the relative error of U4; 2. False positives occur when the input triggers a large atomic condition but fails to cause significant floating-point errors in the final output; 3. Chained condition numbers always correspond to relative errors, indicating the potential effectiveness of chained condition numbers in avoiding false positives; 4. Chained condition numbers can be used for backward error tracking, and by utilizing chained condition numbers, the root cause of relative errors can be found. In the above example, it can be observed that the error in U5 can be traced back to U3, where a catastrophic cancellation occurs in a-U2 operation.
[0083] Based on the above observations, the present invention proposes a new error detection method without test prediction, called FPCC (Floating-Point Chain Condition). Different from the traditional ATOMU method that relies on atomic conditions, the chain condition number describes how the floating-point error is amplified by a series of floating-point operation statements.
[0084] The FPCC of the present invention utilizes chained condition numbers to identify inputs that may trigger major floating-point errors, and avoids false positives and accurately reflects the ability of error propagation by utilizing chained condition numbers. Considering that numerical programs usually consist of a large number of floating-point operations, the present invention uses FPCC to not only reduce false positives, but also improve the efficiency of detecting major errors in numerical programs.
[0085] The present invention will be further described below in conjunction with specific embodiments.
[0086] like Figure 1 As shown, the steps of the numerical program floating point error detection method based on chained condition number guidance in this embodiment include:
[0087] Step S1: Input domain partitioning: Obtain the numerical program P(x) to be tested, and divide the input domain I of the numerical program P(x) to be tested into multiple sub-intervals I s ={i1, i2, ..., i n}, n represents the number of sub-intervals;
[0088] Step S2 Chain Condition Number Guided Search Perform a heuristic search for each subinterval i based on the chain condition number, record the input that can generate the maximum chain condition number for each subinterval, sort all recorded inputs from high to low according to the generated chain condition number, and obtain the input list X={x0, x1, ..., x k} and the maximum number of chained conditions;
[0089] Step S3: Backward error location: Perform reverse error tracking on the searched maximum chain condition number to identify floating-point operations that introduce high chain condition numbers exceeding a preset threshold.
[0090] Given a numerical program P(x), the goal of this embodiment is to identify a set of error-inducing inputs from its input domain I (denoted as X = {x0, x1, ..., x k}). Specifically, assume that F(x) represents an ideal implementation of P(x), for x∈X, Err(F(x), P(x))>E, where E is a predefined error threshold. Since higher precision is required to simulate P(x), obtaining an ideal implementation F(x) may be computationally expensive and time-consuming. In this embodiment, the chain condition number of P(x) is used as a measure of the final floating-point error of P(x), and it is used to guide the search of X for I. The final chain condition number is calculated using the source code of the test floating-point program. The input domain I is divided into many subintervals {i1, i2, ..., i n} and employs a simple but efficient search to identify input sets X = {x1, x2, …, x kFinally, the runtime information and the calculated chained condition number are used to locate the root cause of the floating point error.
[0091] The atomic condition measures how an atomic operation amplifies input errors. Specifically, for a single-input operation op(x), the relative error of the output can be calculated by Equation 4, while for a binary input operation op(x, y), the relative error produced can be measured by Equation (6).
[0092]
[0093] In order to capture the cumulative propagation process of floating point errors during the execution of an operation sequence, this embodiment introduces a chain condition number. The transfer rule of the chain condition number is as follows, which illustrates how to calculate the chain condition number by traversing the operation sequence, where op i →op j means op i The output of op j Input, C op (x) represents the atomic condition number of the operation op facing the input parameter x. In order to calculate the chain condition number generated by a given input, this embodiment constructs the following propagation calculation rule for the chain condition number:
[0094]
[0095] in, represents the sum of input atomic conditions. Rules Init-1 and Init-2 describe the calculation of the chain condition number of the initial statement. The chain condition number of the initial statement of a single-element operation is the condition number of the operation itself, and the chain condition number of the initial statement of a double-element operation is the sum of the condition numbers of the two operands corresponding to the operation. Given an operation sequence seq=<y=op1(x1,x2);z=op2(y)> , since op2 is a single-element operation, the rule Unary captures how the input floating-point error is amplified by seq, that is, the chain condition number at operation op1 is multiplied by the condition number of operation op2; given an operation sequence seq =<x=op1(x1,x2);z=op2(x,y)> And there is no incoming operation that calculates operand y. The rule Binary-1 captures how the floating-point error is amplified by seq, that is, the chained condition number at operation op1 multiplied by the condition number of op2 for parameter x plus the condition number of op2 for parameter y; given an operation sequence seq =<m1=op1(x1,x2);m2=op2(y1,y2);z=op3(m1,m2)> , capturing how the input floating-point error is amplified by seq through the rule Binary-2, which is the chained condition number at operation op1 multiplied by the condition number of op2 for parameter x plus the chained condition number at op1 multiplied by the condition number of op2 for parameter y.
[0096] The final chain condition number calculation idea for input x for program P is: Get the operation sequence Seq = {st0,…, st n}, n ≥ 0, sequentially calculate the number of pre-chained conditional numbers of the operation sequence. For two operations st i and st j , st i →st j (x) indicates st i The output of st j Given an operation st i (0≤i≤n), according to the floating-point operation it depends on, decide which chain condition number calculation rule to use for calculation. The chain condition number of the initial operation is calculated using rules Init-1 and Init-2. Finally, st n The chained condition number of is returned as the final chained condition number of Seq.
[0097] In this embodiment, the operation sequence Seq={st0, ..., st n}(n≥0), scan the statements in turn, and calculate the chain condition number generated by the program P(x) executing the input x based on the calculation propagation rule of the chain condition number according to the operation type of the statement and the dependent statement of the input parameter.
[0098] Identifying inputs that lead to high floating-point errors has long been a challenging problem. Traditional methods such as binary search, differential evolution, and genetic algorithms are limited by low search efficiency and high false positive rates. This embodiment hopes to implement a global search method that can effectively detect inputs that trigger high chain condition numbers in floating-point programs, and customize a simple and effective search algorithm based on the chain condition number features, which can quickly identify large chain condition numbers.
[0099] In order to analyze the characteristics of chain condition numbers, this embodiment randomly samples a large number of inputs from the input domains of the three GSL functions, identifies the inputs that trigger significant floating point errors for each function, and then examines the distribution of floating point errors and chain condition numbers around these inputs. Figure 2 As shown, (a) corresponds to the result of gsl / _sf / bessel / _J0, (b) corresponds to the result of gsl / sf_Insinh, and (c) corresponds to the result of gsl / sf / _Chi. It can be seen from the results that there is a significant consistency between the distribution of the final chain condition number and the distribution of the floating-point error, and the distribution of the final chain condition number shows an obvious gradual increasing trend. Based on the above observations, this embodiment derives two guiding rules: 1) R1: The chain condition number can be used to guide the search for the maximum floating-point error; 2) R2: The change of the chain condition number can guide the search for the potential maximum chain condition number.
[0100] According to the above two guiding rules, this embodiment uses two simple and mature search algorithms (direct search and line search) to explore the false trigger input. Following R1, this embodiment only uses the chain condition number to guide the search for the false trigger input. Consistent with R2, direct search is used to localize the input area that tends to have a large chain condition number, and line search is used to find the input with the maximum chain condition number in the identified input area that may potentially trigger according to the change of the chain condition.
[0101] The steps of step S2 in this embodiment may include:
[0102] Step S201. Direct search: Use a direct search algorithm for each subinterval i to obtain the input x that can trigger the maximum chain condition number for each interval i. i , record x i and its corresponding chain condition number cc i To the collection TempCC l In descending order of chain condition number, the set TempCC l Sort by
[0103] Step S202. Line search: Use line search in the sorted set TempCC lPerform refined sampling near the first limit inputs to try to obtain inputs that can trigger a larger chain condition number, and judge the input x obtained by the line search that triggers a high chain condition number k , if the input x k corresponding condition number is greater than the pre-set chain condition number threshold threshold, then (x k , cc k ) is added to the list CC l . Sort the elements in the list CC l in descending order of the chain condition number to obtain the input list X = {x0, x1,..., x k} that can trigger high floating-point errors.
[0104] Iteratively perform line search near the input x k obtained from the direct search to find a larger chain condition value cc k , k < limit; if the found chain condition value cc k exceeds the specified threshold, then the input x k and its corresponding chain condition value cc k are added to the set CC l . Sort the set CC l in descending order to obtain the maximum chain condition value output.
[0105] In a specific application embodiment, the above method is used to design the following Algorithm 1 to achieve global search, including three main steps: partitioning, direct search, and line search. The algorithm first divides the input domain I into a set of subintervals (denoted as I s ). The basic concept of partitioning is to divide the input domain of the program and determine which subintervals are more likely to trigger high floating-point errors, and then perform refined search on these subintervals. The algorithm uses a non-uniform partitioning method based on the floating-point distribution density. The input range [-288, 288] almost covers all physical constants, thereby increasing the number of subintervals in this range. For example, for a program with an input range from -f max to f max (where f max ≈2 1024 ), the positive subinterval i ∈ I s of the floating-point number is represented as shown in formula (7), and the negative subinterval in I s is just to reverse i and multiply by -1.
[0106]
[0107]
[0108]
[0109]
[0110] Taking the above Algorithm 1 as an example, when performing direct search, in order to identify the input that triggers the large chained condition number of program P, the direct search algorithm is applied to each sub-interval i in I s to generate the input x i and its corresponding chained condition value cc i (corresponding to lines 4 - 7), and these values are stored in the set TempCC l (line 8). To refine the results, TempCC l is sorted in descending order. Then the sorted set is passed to the line search process. When performing the line search, if the condition k < limit is satisfied, the line search is optionally performed for a finite number of iterations (lines 13 - 15). This line search explores the vicinity of the input x k obtained from the direct search to find a larger chained condition value cc k . If cc k exceeds the specified threshold, the input x k and its corresponding chained condition value cc k are added to the set CC l (lines 16 - 18). The set CC l is also sorted in descending order, and the resulting list is assigned to the list X (lines 21 - 22).
[0111] To localize the source code of the error, this embodiment performs reverse tracing on the chained condition number to identify the floating-point operations that introduce large chained condition numbers and propagate them to the output of the program. In this embodiment, step S03 includes:
[0112] Step S301. For a given error-triggering input x, extract the runtime information of all instructions in the numerical program P(x) under test to generate the instruction sequence Seq = {st0,..., st n};
[0113] Step S302. Store the localized source code, and use the function GetPredecors(st n ) to obtain the predecessor statement of the statement st n in Seq. If the chained condition number CC(st i ) of the obtained predecessor statement st i ) > CC(st n ) / w, where w is a user-defined constant greater than 1, then add the predecessor statement st i to the problem statement set SubSeq;
[0114] Step S303: Return the localized source code stored in SubSeq.
[0115] In a specific application embodiment, the above method may be used to design the following error location algorithm based on chained condition numbers, so as to realize error location by using chained condition numbers.
[0116]
[0117] In the above algorithm, the operation sequence Seq = {st0, ..., st n}, n ≥ 0, by sequentially calculating the chain condition number preceding the sequence seq, for the two operations st i and st j , st i →st j (x) indicates st i The output of st j Given an input x, an operation st i (0≤i≤n), by checking the prerequisites of the transition rules, applying the enabled conditional computation sequence {tu0, ..., tu j The chain condition number CC of i , and finally get the final chain condition number CC of Seq n .
[0118] As shown in Algorithm 2 above, for a given error trigger input x, the algorithm extracts runtime information about all instructions in P, thereby generating an instruction sequence Seq = {st0, ..., st n}. Then, use Set SubSeq (initialized to empty) to store the localized source code. The GetPredecors function can get the statement sequence in Seq. n Two precedent statements of i and st j If the chain condition value of the reference statement exceeds the threshold (CC(st n ) / w), the function recursively calls itself using the corresponding statement and updates SubSeq. Finally, the algorithm returns the localized source code stored in SubSeq. For the aforementioned sample code P2, Figure 3 As shown, the algorithm tracks the error from OP5 to OP3 based on the value of the chained condition number and forms a result SubSeq={op5, op3}.
[0119] In a specific application embodiment, the FPC structure of the present invention can be implemented using C++ and Python. The FPCC can measure the provided numerical program, identify the input that triggers important chain condition numbers, and track and localize the source code of potential errors. It mainly includes three parts:
[0120] (1) Upgrade the numerical program P to an instrumented version program A converter to calculate the chain condition number and collect instruction information in P. The converter runs on the LLVMIR code of P and mainly consists of the LLVMPASS module for instrumenting the IR code of P, and includes a handler function for calculating the chain condition number and storing instruction information. For each floating-point instruction, the converter injects a function call to the external handler to calculate the chain condition number in the instruction and store relevant information (such as the instruction ID for backward error tracking).
[0121] (2) Implement Algorithm 1 to detect the searcher with false trigger input. The searcher consists of a direct search engine and a line search engine.
[0122] (3) Implement Algorithm 2 to track and localize the source code of the error. Given an instrumented numerical program and error trigger input x, the tracker collects Run-time information about the program and provides the possible location of the source code that caused the fatal error.
[0123] To verify the effectiveness of the present invention, experiments were conducted using the FPCC of the present invention on 88 functions from the GNU Science Library and 21 functions with multiple inputs from previous studies.
[0124] GSL contains a total of 154 special functions, each of which utilizes floating-point parameters and return values. ATOMU only supports single input and selects 88 univariate functions from the above 154 special functions. In order to directly compare with the most advanced method ATOMU, this embodiment uses the 88 univariate functions for experiments. In order to compare with FPGen (the most advanced tool for detecting high floating-point errors in functions with multiple inputs), this embodiment uses the benchmark provided by FPGen, which consists of 21 benchmarks: 3 sum algorithms, 9 matrix calculation routines from the Meschach library, and 9 statistical routines from the NU Scientific Library (GSL). The code of the 88 GSL functions spans 14 to 329 lines, while the 21 multi-input programs of FPGen consist of 8 to 132 lines, mainly with nested loops such as matrix multiplication.
[0125] Although FPCC is an oracle-free tool for detecting significant errors, it is still necessary to understand the correct results of the program to verify the effectiveness of FPCC. For the 88 special functions of GSL, in order to mitigate precision-dependent operations that may introduce errors in high precision, this embodiment uses mpmath (a library that facilitates arbitrary precision floating-point arithmetic) to compute the oracle of the numerical program P. For the 21 functions with multiple inputs where precision-specific operations are not identified, following the approach of FPGen, this embodiment chooses to use higher precision (long double) exclusively for the oracle.
[0126] In terms of parameter setting, in order to ensure a fair comparison between FPCC and ATOMU (both rely on random seeds during the search process), this embodiment uses FPCC and ATOMU to perform 100 repeated experiments and uses the average results to reduce the impact of randomness on the experimental results. In Algorithm 1, this embodiment sets the limit parameter (line 13) to 10, which means that the first 10 subintervals will be searched for fine lines. This embodiment sets the threshold parameter (line 16) to 1e14. Set W in Algorithm 2 to 100 to track floating-point operations that magnify the chain condition number by 100 times. For k-ary functions, the number of input ranges to be searched increases exponentially, making it difficult for both FPCC and FPGen to search all input ranges within a limited time, so a time limit must be imposed. In traditional FPGen, the experimental time is set to 7200 seconds (2 hours) to obtain the results. Therefore, this embodiment complies with the established settings of FPGen. Given that FPCC does not rely on high-precision test predictions and executes very quickly, this embodiment sets a time limit of 100 seconds for FPCC.
[0127] In terms of evaluation indicators, this embodiment uses the following indicators to evaluate the effectiveness and efficiency of the method:
[0128] Significant floating point error: The error is measured using the relative error Errrel specified in formula (1) and is considered to be greater than 10 -3 is significant.
[0129] Error-triggering inputs: For each project, FPCC and ATOMU generate a list of inputs suspected of causing fatal floating-point errors. For example, ATOMU provides a list of 26 inputs for the function airy_Pi, of which 7 inputs have been confirmed by mpmath to indeed trigger fatal floating-point errors. This example represents the count of these error-triggering inputs as 26, and the result is recorded as "7 / 26" in the "Error-triggering Inputs" column in Table 2.
[0130] Rank-1 input: In the context of FPCC and ATOMU, rank-1 input refers to the top-ranked suspicious input of potential major floating-point errors identified by these methods. These methods do not rely on Oracle and are based on condition numbers. They do not provide actual error values, so rank-1 inputs may not necessarily trigger significant floating-point errors. After 100 repeated experiments, this embodiment obtained 100 rank-1 inputs and evaluated the proportion of these inputs that actually triggered significant floating-point errors. The results of this evaluation are shown in the "% of Rank-1 Inputs" column of Tables 2 and 3. This embodiment was experimented on a desktop running Ubuntu 18.04RTS, equipped with an Intel Core i9-13900@5.20GHz CPU and 32GB RAM.
[0131] In order to better evaluate the FPCC of the present invention, it is compared with ATOMU, which is a state-of-the-art tool for detecting floating-point errors without relying on Oracle. In terms of the effectiveness of detecting functions with significant errors, as shown in Tables 2 and 3, the "%ofRank-1Inputs" column presents the percentage of error-triggering inputs in the rank-1 inputs reported by the FPCC of the present invention and ATOMU in 100 repeated experiments. The "Error-triggering Inputs" column shows the total number of inputs that effectively trigger significant errors among all reported inputs. For example, in the row labeled airy_Ai, the entry "7 / 26" means that ATOMU reports 26 inputs per trace on average, of which 7 inputs can actually trigger significant errors. The "Max RelErr" column illustrates the maximum relative floating-point error triggered by FPCC and ATOMU among all reported inputs. The "Max ULPErr" column shows the maximum value of the ulp error triggered by all reported inputs. In Table 2, the values with better results in each column are shown in bold.
[0132] In terms of the percentage of error-triggering inputs as rank-1 inputs, as shown in Table 2, both FPCC and ATOMU successfully identified inputs that may cause major errors in 42 GSL functions. Since neither method relies on Oracle, the false positive rate plays a crucial role in evaluating its effectiveness in detecting major floating-point errors. Table 1 provides insights into this evaluation. The "% of Rank-1 Inputs" column shows that all rank-1 inputs reported by FPCC trigger serious floating-point errors, achieving a detection rate of 100% (42 / 42). In contrast, ATOMU's rank-1 inputs can trigger major errors in only 25 functions (25 / 42, 59.5%) in 100 repeated experiments. On average, 100% of the rank-1 inputs reported by the present invention FPCC may trigger major errors, while 72.69% of the rank-1 inputs reported by ATOMU may trigger major errors.
[0133] In terms of the number of false triggering inputs, the “False Triggering Inputs” column highlights the remarkable consistency of FPCC in reporting inputs capable of triggering significant floating point errors in all functions, thus demonstrating its robustness. In contrast, ATOMU has limited ability to identify such inputs for most functions. In total, FPCC reports 1053 inputs, of which an impressive 99.62% (1049 inputs) are capable of triggering significant floating point errors.
[0134] Table 2: Results for 42 functions with significant errors.
[0135]
[0136]
[0137] In contrast, ATOMU reports 723 inputs, of which only 19.45% (141 inputs) can trigger major floating-point errors. These statistics further emphasize the superior performance of FPCC in accurately identifying inputs that cause major errors, demonstrating its effectiveness and reliability. Only four inputs reported by the FPCC of the present invention failed to trigger major errors. From the experimental results, it can be seen that the above inputs, especially in the functions bessel_j2(2), bessel_y0(1), and bessel_y1(1), can actually cause relative errors greater than 1e-4, which is very close to 1e-3. In addition, the FPCC of the present invention accurately identified the source code that caused the error based on these four inputs. It can be reasonably believed that the chained condition number used in the FPCC of the present invention is an approximation of the relative error, and the above 4 inputs are still valuable inputs for debugging numerical programs.
[0138] More error triggering inputs may help developers better understand the nature of the errors. For example, in the case of the AIY_AI function, the present invention FPCC identified 58 error triggering inputs. These inputs show that significant errors occur when the inputs are large, which is consistent with the characteristics of imprecision reduction errors. Error repetition analyzes the repetition of all reported errors by tracking the triggering positions in the functions. All reported errors can be traced back to 43 error locations in 42 functions, which are very serious. All 1,053 inputs reported by FPCC can trigger all these error locations. In addition, ATOMU can trigger all these error locations within 141 inputs. ATOMU detects all unstable floating-point instructions iteratively, which means that it traverses all error locations. Therefore, ATOMU's detection should be comprehensive, but not necessarily reliable. For example, for the GSL function AIY_ai, ATOMU reports 26 inputs pointing to more than 10 locations. Although these locations cover the error locations, users cannot determine which location is the actual error location. In contrast, all inputs from FPCC point to the actual error location. Therefore, FPCC mainly solves the false positive problem of ATOMU and aims to improve the reliability of detection.
[0139] In terms of maximum error, in terms of the maximum relative error detected, the FPCC of the present invention performed better in 34 functions, while ATOMU detected higher relative errors in 8 functions. Similarly, FPCC detected higher ULP errors in 38 functions, while ATOMU only detected 4 functions. False positives and false negatives in 46 functions, no major errors. For the 46 functions without major errors, as shown in Table 3, FPCC will not report any inputs. In contrast, ATOMU reports a total of 303 inputs for these functions. However, none of these inputs have the ability to trigger major errors. This embodiment re-ran FPCC using 100 times the sampling input in 46 functions, but the results did not encounter any new functions with major errors. The empirical results show that the FPCC of the present invention does not produce false negatives.
[0140] Table 3: Results for 46 functions with no significant errors.
[0141]
[0142]
[0143] As for the efficiency of the FPCC of the present invention in detecting functions with major errors, in Table 2, the smaller numbers in the Time column are highlighted in bold. In terms of processing functions with major errors, FPCC is much faster, taking about 0.14 seconds, while ATOMU takes 0.30 seconds. The acceleration values shown in the SPEEDUP column of Table 2 range from 1.01x to 5.22x, with an average acceleration of 2.17x. In order to evaluate the statistical significance of the time difference between the two groups, this embodiment performed a Mann-Whitney-Wilcoxon test and obtained a p-value of 1.65*10-4 (<0.05). The p-value indicates that there is a significant difference between the two groups of time. Among the 46 functions that did not have major errors, the Time column in Table 3 shows that FPCC takes less time than ATOMU for most functions. The acceleration range is from 0.87x to 7.40x, with an average acceleration of 2.50x. In addition, the p-value of Mann-Whitney-Wilcoxon test was 0.0026 (<0.05), indicating that there was a significant difference between the two groups of time. Figure 4 Intuitively represent the logarithm (base 2) of the number of inputs per second that may cause significant errors, which are detected by both the FPCC and ATOMU of the present invention. Figure 4 As shown in the figure, where the ordinate represents the number of false trigger inputs detected per second, Log2(N), the FPCC of the present invention outperforms ATOMU in identifying more false trigger inputs per second for all 42 functions. On average, the FPCC of the present invention can detect 253.76 false trigger inputs per second, while ATOMU can detect 18.83 false trigger inputs per second. In terms of false trigger inputs, the FPCC of the present invention achieves a 13.47 times acceleration ratio compared to ATOMU.
[0144] This embodiment further uses FPCC to track and localize the faulty source code in 42 GSL functions with serious errors. Table 3 lists the errors, sample codes, function numbers, and representative function names related to these errors. This embodiment identifies four major types of errors that cause these serious errors in GSL functions.
[0145] Reducing inaccuracy: In Table 3, column 2 provides an example code for reducing inaccuracy. This code is used to reduce a positive input x to the interval [0, π / 4]. The value of y is obtained by floor(x / (0.25*M_PI)), while P1, P2, and P3 are precomputed splits of π / 4 to ensure approximately 75 bits of accuracy.
[0146] Table 4: Results of error detection
[0147]
[0148] Table 4 lists the relative error comparison between mpmath and EFTSEARCH. Results with significant differences between mpmath and EFTSEARCH are shown in gray background. For all 42 functions, there are 7 (7 / 42, 16.7%) functions for which EFTSEARCH cannot give an exact rounding error, i.e., the magnitude of which is very different from that generated by mpmath.
[0149] Table 5: Comparison of relative errors between MPMATH and EFTSEARCH
[0150]
[0151]
[0152] In addition, the chained condition number is more effective than the EFTs-based detection method in capturing error variation trends and identifying major errors. Figure 5 As shown in Figure 1, where the ordinate represents the log2 value of the number of error-triggering inputs for each function, the distribution of floating-point errors in small regions is discrete, making EFTs-based detection susceptible to local optima. In contrast, the chained condition number based on the mathematical concept of condition number exhibits properties similar to a continuous smooth mathematical curve with a clear gradient, allowing faster convergence to the optimal solution. Figure 6 Graph represents the ULP errors of the first-level input of each function detected by the FPCC and ATOMU of the present invention in 100 runs, wherein the ordinate represents the number of ULP errors of the first-level input of each function.
[0153] The FPCC of the present invention avoids the Oracle problem that may be caused by precision-specific operations in two ways: 1) For basic mathematical functions involving a large number of precision-specific operations (such as sin, cos, exp, etc.), the FPCC of the present invention uses mathematical formulas based on condition numbers to process them. For example, the condition number formula of the SIN function, i.e., x*cot(x), can be directly obtained through mathematical semantics. 2) For precision operations in gsl functions, for bitwise operations, FPCC directly passes the chained condition number to the return value without increasing the precision during the calculation process, thereby retaining the semantics of the bitwise operation. For rounding operations such as (x+n)-n, they are implemented in the GSL function by calling the rounding function FLOOR. When encountering a rounding function, FPCC directly passes the chained condition number to the return value without entering the rounding function. Reduction operation is another common precision-specific operation in GSL, such as ((xy*P 1)-y*P2)-y*P3. This reduction operation is valid in the range [-823549.6645, 823549.6645] with bit accuracy. The reduction result becomes less accurate as the input gets larger, and for this reduction operation the chained condition number increases with increasing input values, consistent with the error distribution. Directly computing the reduction operation using high precision will compromise the semantics of the original operation and may fail to identify inputs that truly trigger floating point errors.
[0154] The FPCC of the present invention and ATOMU are executed on the same single-core computer without any concurrent operations, ensuring a fair evaluation of the speedup ratio of FPCC relative to ATOMU. As a result, the speedup of the FPCC of the present invention exceeds that of the conventional ATOMU. The FPCC of the present invention is faster than the ATOMU for the following reasons: (1) Search granularity: ATOMU must search for inputs that trigger a large number of condition numbers for each unstable floating-point operation (e.g., +, -, sin) in turn. In contrast, FPCC only focuses on the condition number of the final output, greatly reducing the number of search iterations. (2) Algorithm differences: ATOMU uses a genetic algorithm that requires multiple sampling and executions per iteration. FPCC combines two algorithms: a direct algorithm for coarse-grained positioning of the input range that may trigger high floating-point errors, followed by a line search algorithm for fine-grained precise positioning without multiple sampling. Therefore, FPCC requires fewer samples overall. (3) Guide function: The consistency of the chain condition and the function error distribution, as well as the inherent function variation properties, enable FPCC to quickly use the gradient of the chain condition as a guide to find inputs that trigger significant errors. Correlation between chained condition number and floating point error According to formula (4), the floating point relative error is approximately the product of the condition number and the backward error, and the chained condition number serves as an approximation of the function condition number. is theoretically invariant to program execution, but the backward error depends on it. Given that the backward error varies between numerical programs, there is no theoretically consistent correlation coefficient relating the chained condition number to the floating point error.
[0155] In summary, the experimental results demonstrate the effectiveness and efficiency of the present invention: (1) For the reported RANK-1 inputs, the present invention FPCC achieves 100PC accuracy in detecting significant errors, while 72.69% of the RANK-1 inputs of the most advanced tool ATOMU can trigger significant errors. Overall, among the inputs reported by the present invention FPCC, 99.64% (1049 / 1053) can trigger significant errors, while only 19.45% (141 / 723) of the inputs reported by ATOMU can trigger significant errors; (2) FPCC is 2.17 times faster than ATOMU in detecting significant errors; (3) FPCC also outperforms the most advanced technology in supporting functions with multiple inputs.
[0156] This embodiment further provides a computer device, including a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to execute the computer program to perform the above method.
[0157] This embodiment further provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the above method is implemented.
[0158] This embodiment also provides a computer program product, which includes computer instructions. The computer instructions are executed by a processor to enable a computer device to implement the above method.
[0159] The above is only a preferred embodiment of the present invention, and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment, it is not intended to limit the present invention. Therefore, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the content of the technical solution of the present invention shall fall within the scope of protection of the technical solution of the present invention.
Claims
1. A method for detecting floating-point errors in numerical programs based on chained conditional guidance, characterized in that the steps include: Step S1: Input domain partitioning: Obtain the numerical program P(x) to be tested, and divide the input domain I of the numerical program P(x) to be tested into multiple sub-intervals I s ={i1, i2, ..., i n }, n represents the number of sub-intervals; Step S2: Chain condition guided search: Perform a heuristic search based on the chain condition number for each subinterval i, record the input that can generate the maximum chain condition number for each subinterval, sort all recorded inputs from high to low according to the generated chain condition number, and obtain the input list X = {x0, x1, ..., x k } and the maximum number of chained conditions; Step S3: backward error location: perform reverse error tracking on the searched maximum chain condition number to identify floating point operations that introduce high chain condition numbers, where the high chain condition number is a chain condition number that exceeds a preset threshold.
2. The method for detecting floating-point errors of numerical programs based on chained conditional guidance according to claim 1 is characterized in that: In step S1, the input domain I is divided into multiple sub-intervals using a non-uniform partitioning method based on the floating point number distribution density. max to f max The program, f max ≈2 1024 , the positive subinterval of floating point numbers i∈I s And satisfy:
3. The method for detecting floating-point errors of numerical programs based on chained conditional guidance according to claim 1 is characterized in that: Step S2 includes: Step S201. Direct search: Use the direct i search algorithm for each subinterval i to obtain the input x that can trigger the maximum chain condition number for each interval i. i , record x i and its corresponding chain condition number cci to the set TempCC l In descending order of chain condition number, the set TempCC l Sort by Step S202. Line search: Use line search to sort the set TempCC l Refine sampling near the first limit inputs in , in order to try to obtain inputs that can trigger a larger number of chain conditions, and determine the input x that triggers a high number of chain conditions obtained by line search k If you input x k If the corresponding condition number is greater than the preset chain condition number threshold, then (x k ,cc k ) is added to the list CC1, and the elements in the list CC1 are sorted in descending order according to the chain condition number to obtain the input list X={x0, x1, ..., x k }.
4. The method for detecting floating-point errors of numerical programs based on chained conditional guidance according to claim 3, characterized in that: It also includes constructing a propagation calculation rule for calculating the chain condition number generated by a given input, wherein the propagation calculation rule for the chain condition number is: Among them, opi→opj means that the output of opi is used as the input of opj, represents the atomic condition number of the operation opj on the input parameter x, represents the sum of input atomic conditions. Rules Init-1 and Init-2 describe the calculation of the chain condition number of the initial statement. The chain condition number of the initial statement of a single-element operation is the condition number of the operation itself, and the chain condition number of the initial statement of a double-element operation is the sum of the condition numbers of the two operands corresponding to the operation. Given an operation sequence seq=<y=op1(x1,x2);z=op2(y)> , since op2 is a single-element operation, the rule Unary captures how the input floating-point error is amplified by seq, that is, the chain condition number at operation op1 is multiplied by the condition number of operation op2; given an operation sequence seq =<x=op1(x1,x2);z=op2(x,y)> And there is no incoming operation that calculates operand y. The rule Binary-1 captures how the floating-point error is amplified by seq, that is, the chained condition number at operation op1 multiplied by the condition number of op2 for parameter x plus the condition number of op2 for parameter y; given an operation sequence seq =<m1=op1(x1,x2);m2=op2(y1,y2);z=op3(m1,m2)> , capturing how the input floating-point error is amplified by seq through the rule Binary-2, which is the chained condition number at operation op1 multiplied by the condition number of op2 for parameter x plus the chained condition number at op1 multiplied by the condition number of op2 for parameter y.
5. The method for detecting floating-point errors of numerical programs based on chained conditional guidance according to claim 4 is characterized in that: The sequence of operations Seq = {st0, ..., st n }, n≥0, scan the statements in sequence, and calculate the chain condition number generated by the program P(x) executing the input x based on the calculation propagation rule of the chain condition number according to the operation type of the statement and the dependent statement of the input parameter.
6. The method for detecting floating-point errors in numerical programs based on chained conditional guidance according to any one of claims 1 to 5, characterized in that: Step S03 includes: For a given error trigger input x, extract the runtime information about all instructions in the numerical program P(x) under test and generate an instruction sequence Seq = {st0, ..., st n }; Store localized source code, use the function GetPredecors(st n )Get the statement st in Seq n The predecessor statement, if the predecessor statement st i The chain condition number CC(st i )>CC(st n ) / w, where w is a user-defined constant greater than 1, the preceding statement st i Add to the problem statement set SubSeq; Returns the localized source code stored in SubSeq.
7. A computer device comprising a processor and a memory, wherein the memory is used to store a computer program, wherein: The processor is used to execute the computer program to perform the numerical program floating point error detection method based on chain conditional guidance as claimed in any one of claims 1 to 6.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for detecting floating-point errors in numerical programs based on chained conditional guidance as claimed in any one of claims 1 to 6 is implemented.
9. A computer program product, characterized in that The computer program product includes computer instructions, which are executed by a processor to enable a computer device to implement the numerical program floating-point error detection method based on chain conditional guidance as described in any one of claims 1 to 6.