Data processing method, apparatus, device, and medium
By separating and processing the exponent and mantissa parts of floating-point data, and using piecewise polynomial fitting to fit the mantissa part, the problem of fitting nonlinear functions with fast change rates is solved, and high-precision fitting results are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-13
- Publication Date
- 2026-03-27
AI Technical Summary
Existing techniques are difficult to effectively fit nonlinear functions with rapid rates of change, such as reciprocals, square roots, and square root reciprocals, leading to fitting difficulties.
The exponent and mantissa parts of the floating-point data are separated and converted into floating-point data format respectively. Piecewise polynomial fitting is performed only on the mantissa part, and finally the fitting result is obtained by floating-point multiplication.
Even when faced with functions that change rapidly, it can achieve accurate fitting, reducing the use of hardware resources and improving fitting accuracy.
Smart Images

Figure CN119621002B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and in particular to a data processing method, device, equipment and medium. BACKGROUND
[0002] The basic units of hardware only include multipliers, adders, shifters and the like, and there is no basic unit capable of directly calculating a nonlinear function.
[0003] In practice, an approximation method is usually used to implement the calculation of a nonlinear function, for example, a piecewise polynomial fitting method. The piecewise polynomial fitting is a method that is relatively compromised in terms of speed, accuracy and resources, and the principle thereof is to divide a target function into a plurality of subsegments, and use a polynomial, i.e., a line segment or a curve, to approximate the target function on each subsegment. For the implementation method of hardware, only multiplication and addition operations expressed by the polynomial need to be performed, and an approximate result of the target function can be obtained.
[0004] However, when the piecewise polynomial fitting method is used to approximate some functions, some functions with a relatively fast change rate, such as reciprocal, square root and reciprocal square root, are often encountered, which leads to difficulty in fitting. SUMMARY
[0005] The problem to be solved by the present application is how to implement piecewise polynomial fitting of more nonlinear functions.
[0006] To solve the above problem, an embodiment of the present application provides a data processing method, which comprises the following steps:
[0007] Obtaining to-be-processed data and a target function, the to-be-processed data being in a floating-point data format, the floating-point data format comprising a sign bit, an exponent part and a mantissa part; the exponent part in the floating-point data format comprising a characteristic code of the floating-point data, and the mantissa part in the floating-point data format comprising a tail code of the floating-point data;
[0008] Separating the exponent part and the mantissa part of the to-be-processed data and respectively converting them into floating-point data formats to obtain an exponent floating-point data and a mantissa floating-point data;
[0009] Using the mantissa floating-point data as a variable of the target function, approximating the target function by using a piecewise polynomial fitting method to obtain a fitting result of the mantissa part;
[0010] Performing floating-point multiplication on the exponent floating-point data and the fitting result of the mantissa part to obtain a fitting result of the to-be-processed data.
[0011] Optionally, the target function is a reciprocal function.
[0012] Optionally, converting the exponent part of the data to be processed into a floating point data format to obtain an exponent floating point data, comprising:
[0013] Taking the sign bit of the data to be processed as the sign bit of the exponent floating point data;
[0014] According to the target function and the exponent part of the data to be processed, obtaining the exponent part of the exponent floating point data;
[0015] The mantissa of the exponent floating point data is 0.
[0016] Optionally, the target function is a square root function.
[0017] Optionally, the target function is a square root reciprocal function.
[0018] Optionally, converting the exponent part of the data to be processed into a floating point data format to obtain an exponent floating point data, comprising:
[0019] Taking the sign bit of the data to be processed as the sign bit of the exponent floating point data;
[0020] According to the target function and the exponent part of the data to be processed, obtaining the exponent part of the exponent floating point data;
[0021] Based on the parity of the order code in the exponent part of the data to be processed, selecting a fixed value from a first fixed value and a second fixed value as the mantissa of the exponent floating point data, the first fixed value being 0, and the second fixed value being 0.414.
[0022] Optionally, converting the mantissa part of the data to be processed into a floating point data format to obtain a mantissa floating point data, comprising:
[0023] Setting the sign bit of the mantissa floating point data to 0;
[0024] Taking the offset code of the floating point data order code as the order code of the mantissa floating point data;
[0025] Taking the tail code in the mantissa part of the data to be processed as the tail code of the mantissa floating point data.
[0026] The embodiment of the application further provides a data processing device, characterized by comprising:
[0027] An acquisition unit is adapted to acquire data to be processed and a target function, the data to be processed being in a floating point data format, the floating point data format comprising a sign bit, an exponent part and a mantissa part;
[0028] The separating unit is suitable for separating the index part and the mantissa part of the data to be processed, and converting them into floating point data format respectively to obtain index floating point data and mantissa floating point data;
[0029] The tail fitting unit is suitable for using piecewise polynomial fitting method to approximate the target function by taking the mantissa floating point data as the variable of the target function to obtain the fitting result of the mantissa part;
[0030] The multiplication unit is suitable for performing floating point multiplication on the index floating point data and the fitting result of the mantissa part to obtain the fitting result of the data to be processed.
[0031] The embodiment of the present application further provides a computer readable storage medium, which has a computer program stored thereon, and the computer program is executed by a processor to realize the steps of any one of the methods.
[0032] The embodiment of the present application further provides an electronic device, which comprises a memory and a processor, and the memory has a computer program stored thereon, the computer program can be run on the processor, and the processor executes the steps of any one of the methods when the computer program is run.
[0033] Compared with the prior art, the technical scheme of the embodiment of the present application has the following advantages:
[0034] According to the scheme of the present application, the index part and the mantissa part of the data to be processed are separated, and then converted into floating point data format to obtain index floating point data and mantissa floating point data, then the mantissa floating point data is subjected to piecewise polynomial fitting, and finally the fitting result of the data to be processed is obtained by performing floating point multiplication on the index floating point data and the fitting result of the mantissa part. Since only the mantissa floating point data is subjected to piecewise polynomial fitting, the interval to be fitted can be compressed into [1, 2), and even if the target function has a fast change rate, the fitting can still be easily realized. BRIEF DESCRIPTION OF DRAWINGS
[0035] Figure 1 is a schematic diagram of first-order piecewise linear fitting;
[0036] Figure 2 is a hardware implementation schematic diagram corresponding to the first-order piecewise linear fitting;
[0037] Figure 3 is a flowchart of a data processing method in the embodiment of the present application;
[0038] Figure 4 is a schematic diagram of the composition of floating point data in IEEE-754 standard;
[0039] Figure 5is a structure diagram of an exponential floating point data and a mantissa floating point data corresponding to a reciprocal function in an embodiment of the present application;
[0040] Figure 6 is a structure diagram of an exponential floating point data and a mantissa floating point data corresponding to a square root function in an embodiment of the present application;
[0041] Figure 7 is a structure diagram of an exponential floating point data and a mantissa floating point data corresponding to a square root reciprocal function in an embodiment of the present application;
[0042] Figure 8 is a structure diagram of a data processing device in an embodiment of the present application. DETAILED DESCRIPTION
[0043] When a piecewise polynomial fitting method is used to approximate some functions, the more the piecewise number and the higher the fitting order, the more accurate the fitting result will be. However, in practical applications, the precision and the use of hardware resources need to be balanced, and usually the order is one or two, and the piecewise number is also not too much. In this way, a line segment or a curve represented by y=ax+b or y=ax+bx+c can be used to fit the target function. 2
[0044] Figure 1 is a schematic diagram of a first-order piecewise linear fitting. Figure 2 is a schematic diagram of a first-order piecewise linear fitting. Figure 2 When x is input, the coefficients a and b corresponding to the interval of x are selected, and the fitting result is obtained through the multiplier and the adder.
[0045] However, when a piecewise polynomial fitting method is used to approximate some functions, some functions with a relatively fast change rate are often encountered, which makes it difficult to fit. For example, the first-order derivative of the reciprocal function and the square root function near 0 changes too fast, which makes it difficult to fit. The slope of the square root reciprocal function tends to infinity, which makes it difficult to fit.
[0046] To solve this problem, the present application provides a data processing method. The index part and the mantissa part of the data to be processed are converted into floating point data formats respectively to obtain exponential floating point data and mantissa floating point data. Then, the mantissa floating point data is fitted by a piecewise polynomial fitting method. Finally, the fitting result of the data to be processed is obtained by performing floating point multiplication on the exponential floating point data and the mantissa fitting result. Since only the mantissa floating point data is fitted by a piecewise polynomial fitting method, the interval to be fitted can be compressed to [1, 2). At this time, even if the target function has a relatively fast change rate, it can still be easily fitted.
[0047] In order to make the above objectives, characteristics and advantages of the present application more apparent, more comprehensible, specific embodiments of the present application are described in detail below with reference to the drawings.
[0048] With reference to Figure 3 The present application provides a data processing method, comprising:
[0049] In step 31, the data to be processed and a target function are obtained.
[0050] The data to be processed is in a floating-point data format, which includes a sign bit, an exponent part and a mantissa part; the exponent part of the floating-point data format includes the characteristic of the floating-point data, and the mantissa part of the floating-point data format includes the mantissa of the floating-point data.
[0051] Floating-point data refers to data in which the position of the decimal point is floating. In contrast to floating-point data, fixed-point data refers to data in which the position of the decimal point is fixed.
[0052] Figure 4 FIG. 1 is a structural diagram of floating-point data in the IEEE-754 standard. With reference to Figure 4 The floating-point data can include a sign bit S, a characteristic E and a mantissa M, and the floating-point data format can be expressed as: (-1) s ×2 E-bias ×(1.M).
[0053] The sign bit S determines whether the floating-point data is positive or negative. The characteristic E is an integer, and the value of the characteristic determines the actual position of the decimal point in the floating-point data. The mantissa M determines the precision of the floating-point data. The sign bit S, the characteristic E and the mantissa M are all binary numbers.
[0054] In the IEEE-754 standard, the base is 2 by default. The bias is an offset code corresponding to the characteristic E, and its value depends on the bit width of the characteristic, for example, in 32-bit floating-point data, the bit width of the characteristic is 8 bits, and accordingly, the offset code bias = 127. In 16-bit floating-point data, the bit width of the characteristic is 5 bits, and the offset code bias = 15.
[0055] In the embodiments of the present application, 2 E-bias , i.e., the decimal number corresponding to the characteristic, is taken as the exponent part of the floating-point data, and (1.M), i.e., the decimal number corresponding to the mantissa, is taken as the mantissa part of the floating-point data. 1.M is a decimal number, and its value interval is [1, 2), so the curve of the target function changes relatively gently within [1, 2) when the mantissa part of the floating-point data is fitted, and thus a good fitting effect can be obtained with a small number of segments.
[0056] Step 32, separate the index part and the mantissa part of the data to be processed, and convert them into floating point data format respectively to obtain index floating point data and mantissa floating point data.
[0057] Since the index part of the data to be processed needs to be multiplied by the processing result of the mantissa part, the data format of the separated index part needs to be the same as that of the mantissa part, and the final output also needs to be in floating point data format. Therefore, the intermediate data can be unified into floating point data format, i.e. the index part of the data to be processed is converted into index floating point data, and the mantissa part is converted into mantissa floating point data.
[0058] In a specific implementation, when the data to be processed is in floating point data format, the index part and the mantissa part of the data to be processed can be separated and processed individually in the calculation process of the target function. For any nonlinear function that can process the index part and the mantissa part of the independent variable individually, it can be used as the target function in the embodiment of the present application. For example, the target function can be the reciprocal function square root function square root reciprocal function logarithmic function (y = log x) or exponential function (y = e^x), etc.
[0059] Specifically, the sign bit is ignored first, and it is assumed that the data to be processed x is positive, and x = 2 a ×b, b ∈ [1, 2), a = Ex-bias, b = 1. M, where E x is the exponent of x.
[0060] Taking the reciprocal function, the square root function and the square root reciprocal function as examples, algebraic identity transformation is performed on the output of the target function, and the following results can be obtained:
[0061] 1) Reciprocal function: where 2 -a can be regarded as the processing result of the index part of the data to be processed x, can be regarded as the processing result of the mantissa part of the data to be processed x;
[0062] 2) Square root function: where 2 can be regarded as the processing result of the index part of the data to be processed x, can be regarded as the processing result of the mantissa part of the data to be processed x;
[0063] 3) Square root reciprocal function: where 2 can be regarded as the processing result of the index part of the data to be processed x, can be regarded as the processing result of the mantissa part of the data to be processed x;
[0064] As can be seen from the above 1) to 3), in the embodiment of the present application, when the data to be processed is in floating-point data format, the objective function is a nonlinear function capable of separately processing the exponent part and the mantissa part of the independent variable, and the correct fitting result can be obtained by multiplying the results after separate processing.
[0065] In a specific implementation, a fixed-point adder can be used to convert the exponent part of the data to be processed into an exponential floating-point data. Specifically, the fixed-point adder can obtain the exponent part of the exponential floating-point data according to the objective function and the exponent part of the data to be processed, and set the mantissa part of the exponential floating-point data to a fixed value.
[0066] In a specific implementation, when the mantissa part of the data to be processed is converted into a mantissa floating-point data, the offset code of the exponent part of the floating-point data can be used as the exponent code of the mantissa floating-point data, and the tail code in the mantissa part of the data to be processed can be used as the tail code of the mantissa floating-point data, and the sign bit of the mantissa floating-point data is always 0.
[0067] In step 33, the mantissa floating-point data is used as a variable of the objective function, and a piecewise polynomial fitting method is used to approximate the objective function to obtain a fitting result of the mantissa part.
[0068] In a specific implementation, a second-order fitting can be used to approximate the mantissa.
[0069] Since the value range of the mantissa floating-point data is [1, 2), only the mantissa floating-point data is fitted, and the problem that it is difficult to fit when the independent variable tends to 0 or to infinity is bypassed.
[0070] In step 34, floating-point multiplication is performed on the exponential floating-point data and the fitting result of the mantissa part to obtain a fitting result of the data to be processed.
[0071] In a specific implementation, the floating-point multiplication result of the exponential floating-point data and the fitting result of the mantissa part is used as the fitting result of the data to be processed, and the percentage error of the final fitting result is equal to the percentage error of the fitting in the interval [1, 2).
[0072] In order to enable those skilled in the art to better understand and implement the present application, the process of obtaining the exponential floating-point data and the mantissa floating-point data will be described in detail below with the objective function being the reciprocal function, the square root function, and the square root reciprocal function as examples:
[0073] 1) Objective function: reciprocal function
[0074] Assume that the exponent code of the output data y is Ey-bias, since Therefore, Ey-bias = - (Ex-bias), so Ey = 2bias-Ex, the exponent of the exponential floating point data is the same as the exponent of the output data y, both are Ey = 2bias-Ex. The mantissa of the exponential floating point data is 0.
[0075] The decimal form of the mantissa floating point data is 1.M, so the exponent of the mantissa floating point data is the binary code corresponding to the offset code bias, and the corresponding exponent is 0. The mantissa of the mantissa floating point data is the same as the mantissa of the data to be processed, both are M.
[0076] The sign bit of the exponential floating point data is the same as the sign bit of the data to be processed, and the sign bit of the mantissa floating point data is always 0. After the separation unit 82, the exponential floating point data and the mantissa floating point data obtained are as shown in Figure 5
[0077] 2) Objective function: square root function
[0078] Assuming that the exponent of the output data y is Ey-bias, since Therefore, Therefore,
[0079] Since Ey may occur the case that the numerator cannot be divided by 2, it is necessary to first check the parity of the exponent Ex, and according to the IEEE-754 standard, bias must be an odd number, for example, in 32-bit floating point data, the offset code bias = 127, and in 16-bit floating point data, the offset code bias = 15.
[0080] Therefore, the mantissa of the exponential floating point data can be determined based on the parity of the exponent in the exponential part of the data to be processed.
[0081] Specifically, when Ex = 2n+1 (n is an integer), the numerator of is even, no additional processing is required, and at this time The mantissa of the exponential floating point data is 0.
[0082] When Ex = 2n, the numerator of is odd and cannot be divided, and the following additional processing is performed: At this time, it is necessary to multiply in order to obtain the correct result, and this can be directly realized by setting the mantissa of the exponential part floating point number, ignoring the implicit bit 1, and the mantissa part only needs to be equal to 0.4142....
[0083] The decimal form of the mantissa floating point data is 1.M, so the exponent of the mantissa floating point data is 1, and the corresponding decimal form is bias. The mantissa of the mantissa floating point data is the same as the mantissa of the data to be processed, both are M.
[0084] The sign bit of the exponent floating point data is the same as that of the data to be processed, and the sign bit of the mantissa floating point data is always 0. Figure 6
[0085] 3) Objective function: square root reciprocal function
[0086] Suppose the characteristic of the output data y is Ey-bias, since Therefore, Therefore, The mantissa of the exponent floating point data is 0.
[0087] Since the numerator of Ey may not be divisible by 2, the parity of the characteristic Ex needs to be checked first, and based on the parity of Ex, the mantissa of the exponent floating point data is determined.
[0088] Specifically, when Ex=2n+1, the numerator is even, no additional processing is needed, and then
[0089] When Ex=2n, the numerator is odd and cannot be divided, and the following additional processing is performed, then At this time, the mantissa needs to be equal to 0.4142… to get the correct result.
[0090] The decimal form of the mantissa floating point data is 1.M, so the characteristic of the mantissa floating point data is 1, and the corresponding decimal form is bias. The mantissa code of the mantissa floating point data is the same as that of the data to be processed, and is M.
[0091] The sign bit of the exponent floating point data is the same as that of the data to be processed, and the sign bit of the mantissa floating point data is always 0. After the separation unit 82, the obtained exponent floating point data and mantissa floating point data are as shown in Figure 7
[0092] From the above, after separating the exponent part and the mantissa part of the data to be processed, the characteristic of the exponent floating point data can be obtained by using the characteristic of the data to be processed and a certain constant, and the operation of dividing by 2 can be completed by binary shift, and the mantissa code is selected by the two-way selector as 0 or 0.4142… For the mantissa part of the data to be processed, only the characteristic of the data to be processed is replaced by bias, and the mantissa code of the data to be processed is used as the mantissa code of the mantissa floating point data.
[0093] In the embodiment of the present application, for the case that the order is not divisible by 2, the square root of 2 is put into the mantissa code of the separated exponent floating point data, so that the approximation of the mantissa part only needs to fit the true function, and there is no need to set two sets of lookup tables according to the parity of the characteristic, thereby saving storage resources.
[0094] It should be noted that in the embodiments of the present application, the target function includes but is not limited to the reciprocal function, the square root function and the square root reciprocal function, and can also be other functions, as long as the function is suitable for separate processing of the mantissa part and the exponent part of the data to be processed. For any target function, only a small amount of modification on the circuit can be made to complete the extension support for the corresponding function.
[0095] In order for those skilled in the art to better understand and implement the present application, the device, computer readable storage medium and electronic equipment corresponding to the above method are described in detail below.
[0096] Referring to Figure 8 , the embodiments of the present application also provide a data processing device 80, which can include an acquisition unit 81, a separation unit 82, a tail fitting unit 83 and a multiplication unit 84. Wherein:
[0097] The acquisition unit 81 is adapted to acquire the data to be processed and the target function, the data to be processed is in floating point data format, and the floating point data format includes a sign bit, an exponent part and a mantissa part;
[0098] The separation unit 82 is adapted to separate the exponent part and the mantissa part of the data to be processed, and convert them into floating point data format respectively to obtain exponent floating point data and mantissa floating point data;
[0099] The tail fitting unit 83 is adapted to use the segmented polynomial fitting method to approximate the target function by taking the mantissa floating point data as a variable of the target function, to obtain a fitting result of the mantissa part;
[0100] The multiplication unit 84 is adapted to perform floating point multiplication on the exponent floating point data and the fitting result of the mantissa part to obtain a fitting result of the data to be processed.
[0101] In an embodiment, when the target function is a reciprocal function, referring to Figure 5 , the separation unit 82 can take the sign bit of the data to be processed x as the sign bit of the exponent floating point data when converting the exponent part of the data to be processed into exponent floating point data, and obtain the exponent part of the exponent floating point data according to the target function and the exponent part of the data to be processed, and set the mantissa of the exponent floating point data to 0.
[0102] In another embodiment, when the target function is a square root function or a square root reciprocal function, referring to Figure 6 and Figure 7The separation unit 82 can take the sign bit of the to-be-processed data x as the sign bit of the exponential floating point data when converting the index part of the to-be-processed data into the exponential floating point data, and obtain the index part of the exponential floating point data according to the target function and the index part of the to-be-processed data. The separation unit 82 can be further provided with a selection subunit 821, which selects a fixed value from a first fixed value and a second fixed value as the mantissa of the exponential floating point data based on the parity of the exponent of the index part of the to-be-processed data. The first fixed value is 0, and the second fixed value is 0.414.
[0103] In yet another embodiment, with reference to Figure 5 to Figure 7 When the separation unit 82 converts the mantissa part of the to-be-processed data into the mantissa floating point data, the sign bit of the mantissa floating point data can be set as 0, the offset code of the floating point data exponent is taken as the exponent of the mantissa floating point data, and the tail code in the mantissa part of the to-be-processed data is taken as the tail code of the mantissa floating point data.
[0104] With the above data processing apparatus 80, for any function that can separate the index part and the mantissa part for processing, almost no new logic resources are needed to achieve fitting. In the calculation process, no rounding and truncation errors are introduced, all the results obtained by the index part are accurate results, and the percentage error of the final fitting result is equal to the percentage error of the fitting in the interval [1, 2), and the accuracy is high.
[0105] The embodiment of the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps of any one of the above methods.
[0106] In specific implementation, the computer readable storage medium can include ROM, RAM, magnetic disk or optical disk, etc.
[0107] The embodiment of the present application further provides an electronic device, which includes a memory and a processor, and the memory stores a computer program capable of running on the processor, and the processor executes the steps of any one of the above methods when executing the computer program.
[0108] The various modules / units included in the various devices and products described in the above embodiments can be software modules / units or hardware modules / units, or partially software modules / units and partially hardware modules / units. For example, for the various devices and products applied to or integrated in a chip, the various modules / units included therein can all be implemented in the form of hardware such as circuitry, or at least some of the modules / units can be implemented in the form of a software program running on a processor integrated in the chip, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuitry; for the various devices and products applied to or integrated in a chip module, the various modules / units included therein can all be implemented in the form of hardware such as circuitry, and different modules / units can be located in the same component (e.g., a chip, a circuit module, etc.) or different components of the chip module, or at least some of the modules / units can be implemented in the form of a software program running on a processor integrated in the chip module, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuitry; for the various devices and products applied to or integrated in a terminal, the various modules / units included therein can all be implemented in the form of hardware such as circuitry, and different modules / units can be located in the same component (e.g., a chip, a circuit module, etc.) or different components of the terminal, or at least some of the modules / units can be implemented in the form of a software program running on a processor integrated in the terminal, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuitry.
[0109] Although the present application has been disclosed with reference to the above embodiments, the present application is not limited to the above embodiments. Any person skilled in the art, without departing from the spirit and scope of the present application, can make various modifications and changes, and the scope of protection of the present application should be limited by the scope defined by the claims.
Claims
1. A data processing apparatus, characterized in that, include: The acquisition unit is adapted to acquire data to be processed and an objective function. The data to be processed is in floating-point data format, which includes a sign bit, an exponent part, and a mantissa part. The exponent part of the floating-point data format includes the exponent of the floating-point data, and the mantissa part of the floating-point data format includes the mantissa of the floating-point data. The separation unit is adapted to separate the exponent part and the mantissa part of the data to be processed, and convert them into floating-point data format respectively to obtain exponent floating-point data and mantissa floating-point data; The tail fitting unit is adapted to use the mantissa floating-point data as a variable of the objective function, and to approximate the objective function using a piecewise polynomial fitting method to obtain the mantissa fitting result. The multiplication unit is adapted to perform floating-point multiplication on the fitting result of the exponent floating-point data and the mantissa part to obtain the fitting result of the data to be processed. Wherein, the objective function is a reciprocal function, a square root function, or a square root reciprocal function; When the target function is a square root function or a square root reciprocal function, the separation unit, when converting the exponent part of the data to be processed into exponential floating-point data, uses the sign bit of the data to be processed x as the sign bit of the exponential floating-point data, and obtains the exponent part of the exponential floating-point data according to the target function and the exponent part of the data to be processed; the separation unit is further provided with a selection subunit, which selects a fixed value from a first fixed value and a second fixed value based on the parity of the exponent in the exponent part of the data to be processed, as the mantissa of the exponential floating-point data; wherein, the first fixed value is 0, and the second fixed value is 0.414; When the objective function is a reciprocal function, the separation unit, when converting the exponential part of the data to be processed into exponential floating-point data, uses the sign bit of the data to be processed as the sign bit of the exponential floating-point data, and obtains the exponential part of the exponential floating-point data according to the objective function and the exponential part of the data to be processed; the mantissa of the exponential floating-point data is 0.
2. The data processing apparatus as described in claim 1, characterized in that, When the separation unit converts the mantissa portion of the data to be processed into floating-point data format, it sets the sign bit of the mantissa floating-point data to 0, uses the offset code of the floating-point data exponent as the exponent of the mantissa floating-point data, and uses the mantissa code in the mantissa portion of the data to be processed as the mantissa code of the mantissa floating-point data.
3. An electronic device comprising a memory and a processor, wherein the memory stores a computer program capable of running on the processor, characterized in that, When the processor runs the computer program, it performs the steps of the method of claim 1 or 2.
Citation Information
Patent Citations
Method for improving OTDR logarithmic computation speed
CN103617148A
Method and device for processing floating-point number
CN105224284A