Data processing method and device, equipment and medium
By separating and converting the exponential and mantissa parts of floating point data, performing a segmented polynomial fitting of the mantissa part and multiplying it with the exponential part, the problem of difficulty in fitting nonlinear functions with fast change rates is solved in the existing technology, and a more efficient fitting effect is achieved.
Patent Information
- Application Number
- CN202311185820.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-13
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2043-09-13
AI Technical Summary
The prior art is difficult to fit when approximate certain nonlinear functions with relatively fast rate of change using segmented polynomial fitting method.
By separating the exponential part and mantissa part of the to-process data, converting it into floating-point data formats respectively, then performing segmented polynomial fitting of the mantissa floating-point data, and finally performing floating-point multiplication on the exponential floating-point data and mantissa part fitting results, the fitting results of the to-process data are obtained.
Compressing the interval to be fit into [1, 2) solves the problem that functions with faster change rates are difficult to fit, and achieves easier fitting effects.
Smart Images

Figure CN119621002A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a data processing method, device, equipment and medium. Background Art
[0002] The basic units of the hardware only include multipliers, adders, shifters, etc. There is no basic unit that can directly calculate nonlinear functions.
[0003] In practice, approximation methods are usually used to calculate nonlinear functions, such as piecewise polynomial fitting. Among them, piecewise polynomial fitting is a method that compromises speed, accuracy, and resources. Its principle is to divide the target function into several sub-segments, and use a polynomial on each sub-segment, that is, use a line segment or curve to approximate the target function. The corresponding hardware implementation method only needs to perform multiplication and addition operations as expressed by the polynomial to obtain the approximate result of the target function.
[0004] However, when using the piecewise polynomial fitting method to approximate certain functions, we often encounter some functions with relatively fast changing rates, such as the reciprocal, square root, reciprocal of square root, etc., which makes it difficult to fit. Summary of the invention
[0005] The problem to be solved by the present invention is: how to realize piecewise polynomial fitting of more nonlinear functions.
[0006] To solve the above problem, an embodiment of the present invention provides a data processing method, which includes:
[0007] Obtaining data to be processed and a target function, wherein the data to be processed is in a floating-point data format, and the floating-point data format includes a sign bit, an exponent part, and a mantissa part; the exponent part in the floating-point data format includes an exponent of the floating-point data, and the mantissa part in the floating-point data format includes a mantissa of the floating-point data;
[0008] Separating the exponent part and the mantissa part of the data to be processed, and converting them into floating point data formats respectively, to obtain exponential floating point data and mantissa floating point data;
[0009] The mantissa floating-point data is used as a variable of the objective function, and the objective function is approximated by a piecewise polynomial fitting method to obtain a mantissa partial fitting result;
[0010] Floating-point multiplication is performed on the exponential floating-point data and the fitting result of the mantissa part to obtain the fitting result of the data to be processed.
[0011] Optionally, the objective function is a reciprocal function.
[0012] Optionally, converting the exponential part of the data to be processed into a floating point data format to obtain exponential floating point data includes:
[0013] Using the sign bit of the data to be processed as the sign bit of the exponential floating-point data;
[0014] According to the objective function and the exponential part of the data to be processed, obtaining the exponential part of the exponential floating point data;
[0015] The mantissa of the exponential floating point data is 0.
[0016] Optionally, the objective function is a square root function.
[0017] Optionally, the objective function is an inverse square root function.
[0018] Optionally, converting the exponential part of the data to be processed into a floating point data format to obtain exponential floating point data includes:
[0019] Using the sign bit of the data to be processed as the sign bit of the exponential floating-point data;
[0020] According to the objective function and the exponential part of the data to be processed, obtaining the exponential part of the exponential floating point data;
[0021] Based on the parity of the order code in the exponential part of the data to be processed, a fixed value is selected from a first fixed value and a second fixed value as the mantissa of the exponential floating point data, the first fixed value is 0, and the second fixed value is 0.414.
[0022] Optionally, converting the mantissa part of the data to be processed into a floating point data format to obtain mantissa floating point data includes:
[0023] Set the sign bit of the mantissa floating-point data to 0;
[0024] Using the offset code of the floating point data exponent as the exponent of the mantissa floating point data;
[0025] The tail code in the mantissa part of the data to be processed is used as the tail code of the mantissa floating-point data.
[0026] An embodiment of the present invention further provides a data processing device, characterized in that it includes:
[0027] An acquisition unit, adapted to acquire data to be processed and a target function, wherein the data to be processed is in a floating point data format, and the floating point data format includes a sign bit, an exponent part, and a mantissa part;
[0028] A separation unit, adapted to separate the exponential part and the mantissa part of the data to be processed, and convert them into floating point data formats respectively, to obtain exponential floating point data and mantissa floating point data;
[0029] A tail fitting unit, adapted to use the mantissa floating point data as a variable of an objective function, and use a piecewise polynomial fitting method to approximate the objective function to obtain a mantissa fitting result;
[0030] The multiplication unit is adapted to perform floating-point multiplication on the exponential floating-point data and the fitting result of the mantissa part to obtain the fitting result of the data to be processed.
[0031] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the steps of any of the above methods.
[0032] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the steps of any of the above methods when running the computer program.
[0033] Compared with the prior art, the technical solution of the embodiment of the present invention has the following advantages:
[0034] By applying the scheme of the present invention, the exponential part and the mantissa part of the data to be processed are separated and converted into floating-point data formats respectively to obtain exponential floating-point data and mantissa floating-point data, and then the mantissa floating-point data is fitted with a piecewise polynomial, and finally the fitting result of the data to be processed is obtained by performing floating-point multiplication on the fitting results of the exponential floating-point data and the mantissa part. Since only the mantissa floating-point data is fitted with a piecewise polynomial, the interval to be fitted can be compressed to [1, 2). At this time, even if the target function has a fast changing rate, it can still be easily fitted. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a schematic diagram of a first-order piecewise linear fit;
[0036] Figure 2 This is the hardware implementation schematic diagram corresponding to the first-order piecewise linear fitting;
[0037] Figure 3 is a flow chart of a data processing method in an embodiment of the present invention;
[0038] Figure 4 This is a schematic diagram of the structure of floating-point data in the IEEE-754 standard;
[0039] Figure 5It is a structural schematic diagram of exponential floating-point data and mantissa floating-point data corresponding to a reciprocal function in an embodiment of the present invention;
[0040] Figure 6 It is a structural schematic diagram of exponential floating-point data and mantissa floating-point data corresponding to a square root function in an embodiment of the present invention;
[0041] Figure 7 It is a structural schematic diagram of exponential floating-point data and mantissa floating-point data corresponding to a square root inverse function in an embodiment of the present invention;
[0042] Figure 8 It is a structural schematic diagram of a data processing device in an embodiment of the present invention. DETAILED DESCRIPTION
[0043] When using the piecewise polynomial fitting method to approximate certain functions, the more segments there are and the higher the fitting order, the more accurate the fitting result will be. However, in actual applications, it is necessary to balance the accuracy and the use of hardware resources. Usually, the order is first or second order, and the number of segments will not be too large. In this way, y=ax+b or y=ax 2 +bx+c to fit the objective function.
[0044] Figure 1 Schematic diagram of first-order piecewise linear fitting. Figure 2 This is the hardware implementation schematic diagram corresponding to the first-order piecewise linear fitting. Figure 2 When x is input, the coefficients a and b of the interval corresponding to x are selected, and the fitting result is obtained through the multiplier and adder.
[0045] However, when using the piecewise polynomial fitting method to approximate certain functions, we often encounter some functions with relatively fast changing rates, which makes it difficult to fit. For example, the first-order derivative of the reciprocal function and the square root function changes too fast near the independent variable 0, making it difficult to fit. The slope of the reciprocal square root function keeps changing in the direction where the independent variable tends to infinity and has no upper bound, making it difficult to fit.
[0046] In view of this problem, the present invention provides a data processing method, which converts the exponential part and the mantissa part of the data to be processed into floating-point data formats respectively to obtain exponential floating-point data and mantissa floating-point data, then performs piecewise polynomial fitting on the mantissa floating-point data, and finally performs floating-point multiplication on the fitting results of the exponential floating-point data and the mantissa part to obtain the fitting result of the data to be processed. Since only the mantissa floating-point data is fitted with a piecewise polynomial, the interval to be fitted can be compressed to [1, 2). At this time, even if the target function has a fast changing rate, it can still be easily fitted.
[0047] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0048] Reference Figure 3 , an embodiment of the present invention provides a data processing method, the method comprising:
[0049] Step 31, obtaining the data to be processed and the target function.
[0050] Among them, 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; the exponent part in the floating-point data format includes the exponent of the floating-point data, and the mantissa part in 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 in the data is not fixed. The opposite of floating point data is fixed point data, which means the position of the decimal point does not change.
[0052] Figure 4 This is a schematic diagram of the structure of floating-point data in the IEEE-754 standard. Figure 4 , floating point data can include a sign bit S, an exponent E and a tail code M. 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 exponent E is an integer, and the exponent value 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 exponent E, and the mantissa M are all binary numbers.
[0054] In the IEEE-754 standard, the default base is 2. bias is the offset code corresponding to the exponent E, and its value depends on the bit width of the exponent. For example, in 32-bit floating-point data, the exponent bit width is 8 bits, and accordingly, the offset code bias = 127. In 16-bit floating-point data, the exponent bit width is 5 bits, and the offset code bias = 15.
[0055] In the embodiment of the present invention, in the floating point data format, 2 E-bias , i.e. the decimal number corresponding to the exponent code, is used as the exponent part of the floating-point data. (1.M), i.e. the decimal number corresponding to the mantissa code, is used as the mantissa part of the floating-point data. 1.M is a decimal with a value range of [1, 2). Therefore, when fitting the mantissa part of the floating-point data later, the curve of the objective function changes relatively smoothly within [1, 2). Therefore, a good fitting effect can be obtained with only a small number of segmented segments.
[0056] Step 32, separating the exponent part and the mantissa part of the data to be processed, and converting them into floating point data formats respectively, to obtain exponential floating point data and mantissa floating point data.
[0057] Since the exponential part of the separated data to be processed needs to be multiplied with the processing result of the mantissa part, the data format of the separated exponential part needs to be the same as the data format 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, that is, the exponential part of the data to be processed is converted into exponential 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 exponential part and the mantissa part of the data to be processed can be separated and processed separately during the calculation of the objective function. Any nonlinear function that can process the exponential part and the mantissa part of the independent variable separately can be used as the objective function in the embodiment of the present invention. For example, the objective function can be the reciprocal function Square root function Inverse Square Root Function Logarithmic function (y=log x) or exponential function (y=e^x), etc.
[0059] Specifically, ignoring the sign bit, assume that the data to be processed x is a positive number, 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 objective functions as the reciprocal function, square root function, and reciprocal square root function, the output of the objective function is transformed into an algebraic expression to obtain:
[0061] 1) Reciprocal function: Among them, 2 -a It can be regarded as the result of processing the exponential part of the data x to be processed. It can be regarded as the result of processing the mantissa of the data x to be processed;
[0062] 2) Square root function: in, It can be regarded as the result of processing the exponential part of the data x to be processed. It can be regarded as the result of processing the mantissa of the data x to be processed;
[0063] 3) Inverse square root function: in, It can be regarded as the result of processing the exponential part of the data x to be processed. It can be regarded as the result of processing the mantissa of the data x to be processed;
[0064] It can be seen from the above 1) to 3) that in the embodiment of the present invention, when the data to be processed is in floating-point data format, the objective function is a nonlinear function that can process the exponential part and the mantissa part of the independent variable separately, and the correct fitting result can be obtained by multiplying the results after the separate processing.
[0065] In a specific implementation, a fixed-point adder can be used to convert the exponential part of the data to be processed into exponential floating-point data. Specifically, the fixed-point adder can obtain the exponential part of the exponential floating-point data according to the target function and the exponential 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 mantissa floating-point data, the offset code of the floating-point data exponent can be used as the exponent of the mantissa floating-point data, and the mantissa code in the mantissa part of the data to be processed can be used as the mantissa code of the mantissa floating-point data, and the sign bit of the mantissa floating-point data is always 0.
[0067] Step 33, using the mantissa floating-point data as the variable of the objective function, using a piecewise polynomial fitting method to approximate the objective function, and obtaining a mantissa partial fitting result.
[0068] In a specific implementation, the mantissa approximation may be implemented using a second-order fitting.
[0069] Since the value range of the mantissa floating-point data is [1, 2), only the mantissa floating-point data is fitted, which avoids the problem that the interval where the independent variable tends to 0 or tends to infinity is difficult to fit.
[0070] Step 34, performing floating-point multiplication on the exponential floating-point data and the fitting result of the mantissa part to obtain the 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 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 invention, the process of obtaining the exponential floating-point data and the mantissa floating-point data is described in detail by taking the objective functions as the reciprocal function, the square root function, and the reciprocal square root function as examples:
[0073] 1) Objective function: inverse function
[0074] Assume that the order 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 of which 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 floating-point data has the same mantissa as the data to be processed, both of which 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 are obtained as follows: Figure 5 shown.
[0077] 2) Objective function: square root function
[0078] Assume that the order of the output data y is Ey-bias, since therefore, Therefore
[0079] Since the numerator of Ey may not be divisible by 2, it is necessary to first check the parity of the exponent code Ex. 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 order code in the exponential part of the data to be processed.
[0081] Specifically, when Ex=2n+1 (n is an integer), The numerator of is an even number, no additional processing is required. The exponential floating point data has a mantissa of 0.
[0082] When Ex = 2n, The numerator of is an odd number and cannot be divided evenly. The following additional processing is performed: At this time, you need to multiply To get the correct result, this This can be achieved directly by setting the mantissa of the floating-point number in the exponent part, 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 floating-point data has the same mantissa as the data to be processed, both of which are M.
[0084] 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 are obtained as follows: Figure 6 shown.
[0085] 3) Objective function: inverse square root function
[0086] Assume that the order of the output data y is Ey-bias, since therefore, Therefore The exponential floating point data has a mantissa of 0.
[0087] Since the numerator of Ey may not be divisible by 2, it is necessary to first check the parity of the exponent Ex and determine the mantissa of the exponent floating-point data based on the parity of Ex.
[0088] Specifically, when Ex = 2n + 1, the numerator is an even number and no additional processing is required.
[0089] When Ex = 2n, the numerator is an odd number and cannot be divided evenly. The following additional processing is performed: At this time, the tail number must 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 exponent of the mantissa floating-point data is 1, and the corresponding decimal form is bias. The mantissa floating-point data has the same mantissa as the data to be processed, both of which are M.
[0091] 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 are obtained as follows: Figure 7 shown.
[0092] From the above content, it can be known that after separating the exponent part and the mantissa part of the data to be processed, the exponent of the exponential floating-point data can be obtained by adding and subtracting the exponent 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 is selected by a two-choice selector as 0 or 0.4142... For the mantissa part of the data to be processed, it is only necessary to replace the exponent of the data to be processed with bias, and the mantissa of the data to be processed is used as the mantissa of the mantissa floating-point data.
[0093] In an embodiment of the present invention, in case the exponent cannot be divided by 2, the square root of 2 is placed in the mantissa of the separated exponential floating-point data, so that the approximation of the mantissa part only requires fitting the true function, and there is no need to set two sets of lookup tables according to the parity of the exponent, thereby saving storage resources.
[0094] It should be noted that, in the embodiment of the present invention, the objective function includes but is not limited to the reciprocal function, the square root function and the reciprocal square root function, and may also be other functions, as long as the function is suitable for processing the mantissa part and the exponent part of the data to be processed separately. For any objective function, only a small amount of modification is required on the circuit to complete the extended support for the corresponding function.
[0095] In order to enable those skilled in the art to better understand and implement the present invention, the apparatus, computer-readable storage medium and electronic device corresponding to the above method are described in detail below.
[0096] Reference Figure 8 The embodiment of the present invention further provides a data processing device 80, which may 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, wherein the data to be processed is in a 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 exponential part and the mantissa part of the data to be processed, and convert them into floating point data formats respectively to obtain exponential floating point data and mantissa floating point data;
[0099] The tail fitting unit 83 is adapted to use the mantissa floating point data as a variable of an objective function, and use a piecewise polynomial fitting method to approximate the objective function to obtain a mantissa fitting result;
[0100] The multiplication unit 84 is adapted to perform floating-point multiplication on the exponential floating-point data and the fitting result of the mantissa part to obtain the fitting result of the data to be processed.
[0101] In one embodiment, when the objective function is a reciprocal function, refer to Figure 5 When the separation unit 82 converts the exponential part of the data to be processed into exponential floating-point data, the sign bit of the data to be processed x can be used as the sign bit of the exponential floating-point data, and the exponential part of the exponential floating-point data can be obtained according to the objective function and the exponential part of the data to be processed, and the mantissa of the exponential floating-point data can be set to 0.
[0102] In another embodiment, when the objective function is a square root function or an inverse square root function, referring to Figure 6 and Figure 7When converting the exponential part of the data to be processed into exponential floating-point data, the separation unit 82 may use the sign bit of the data to be processed x as the sign bit of the exponential floating-point data, and obtain 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 separation unit 82 may also be provided with a selection subunit 821, and the selection subunit 821 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 order code in the exponential part of the data to be processed. The first fixed value is 0, and the second fixed value is 0.414.
[0103] In yet another embodiment, referring to Figures 5 to 7 When the separation unit 82 converts the mantissa part of the data to be processed into mantissa floating-point data, the sign bit of the mantissa floating-point data can be set to be always 0, the offset code of the floating-point data exponent can be used as the exponent of the mantissa floating-point data, and the mantissa in the mantissa part of the data to be processed can be used as the mantissa of the mantissa floating-point data.
[0104] By using the above data processing device 80, any function that can process the exponential part and the mantissa part separately can be fitted without adding any additional logic resources. In addition, no rounding or truncation errors are introduced in the calculation process, and the results obtained by all exponential parts are accurate results. The percentage error of the final fitting result is equal to the percentage error of fitting in the interval [1, 2), and the accuracy is relatively high.
[0105] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the steps of any of the above methods.
[0106] In a specific implementation, the computer-readable storage medium may include: ROM, RAM, magnetic disk or optical disk, etc.
[0107] An embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the steps of any of the above methods when running the computer program.
[0108] Regarding the various modules / units included in the various devices and products described in the above embodiments, they can be software modules / units, or hardware modules / units, or they can be partially software modules / units and partially hardware modules / units. For example, for 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 circuits, or at least some of the modules / units can be implemented in the form of software programs, which run on a processor integrated inside the chip, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuits; for 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 circuits, and different modules / units can be located in the same component (such as a chip, 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 hardware such as circuits. The element can be implemented in the form of a software program, which runs on a processor integrated inside the chip module, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuits; for various devices and products applied to or integrated in the terminal, the various modules / units contained therein can be implemented in the form of hardware such as circuits, and different modules / units can be located in the same component (for example, chip, circuit module, etc.) or in different components in the terminal, or, at least some modules / units can be implemented in the form of a software program, which runs on a processor integrated inside the terminal, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuits.
[0109] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the claims.
Claims
1. A data processing method, characterized in that: include: Obtaining data to be processed and a target function, wherein the data to be processed is in a floating-point data format, and the floating-point data format includes a sign bit, an exponent part, and a mantissa part; the exponent part in the floating-point data format includes an exponent of the floating-point data, and the mantissa part in the floating-point data format includes a mantissa of the floating-point data; Separating the exponent part and the mantissa part of the data to be processed, and converting them into floating point data formats respectively, to obtain exponential floating point data and mantissa floating point data; The mantissa floating-point data is used as a variable of the objective function, and the objective function is approximated by a piecewise polynomial fitting method to obtain a mantissa partial fitting result; Floating-point multiplication is performed on the exponential floating-point data and the fitting result of the mantissa part to obtain the fitting result of the data to be processed.
2. The data processing method according to claim 1, characterized in that: The objective function is a reciprocal function.
3. The data processing method according to claim 2, characterized in that: Converting the exponential part of the data to be processed into a floating point data format to obtain exponential floating point data, including: Using the sign bit of the data to be processed as the sign bit of the exponential floating-point data; According to the objective function and the exponential part of the data to be processed, obtaining the exponential part of the exponential floating point data; The mantissa of the exponential floating point data is 0.
4. The data processing method according to claim 1, characterized in that: The objective function is a square root function.
5. The data processing method according to claim 1, characterized in that: The objective function is an inverse square root function.
6. The data processing method according to claim 4 or 5, characterized in that: Converting the exponential part of the data to be processed into a floating point data format to obtain exponential floating point data, including: Using the sign bit of the data to be processed as the sign bit of the exponential floating-point data; According to the objective function and the exponential part of the data to be processed, obtaining the exponential part of the exponential floating point data; Based on the parity of the order code in the exponential part of the data to be processed, a fixed value is selected from a first fixed value and a second fixed value as the mantissa of the exponential floating point data, the first fixed value is 0, and the second fixed value is 0.
414.
7. The data processing method according to claim 1, 4 or 5, characterized in that: Converting the mantissa part of the data to be processed into a floating point data format to obtain mantissa floating point data, including: Set the sign bit of the mantissa floating-point data to 0; Using the offset code of the floating point data exponent as the exponent of the mantissa floating point data; The tail code in the mantissa part of the data to be processed is used as the tail code of the mantissa floating-point data.
8. A data processing device, characterized in that: include: An acquisition unit, adapted to acquire data to be processed and a target function, wherein the data to be processed is in a floating point data format, and the floating point data format includes a sign bit, an exponent part, and a mantissa part; A separation unit, adapted to separate the exponential part and the mantissa part of the data to be processed, and convert them into floating point data formats respectively, to obtain exponential floating point data and mantissa floating point data; A tail fitting unit, adapted to use the mantissa floating point data as a variable of an objective function, and use a piecewise polynomial fitting method to approximate the objective function to obtain a mantissa fitting result; The multiplication unit is adapted to perform floating-point multiplication on the exponential floating-point data and the fitting result of the mantissa part to obtain the fitting result of the data to be processed.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer program is executed by a processor to implement the steps of the method according to any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor runs the computer program, the steps of the method according to any one of claims 1 to 7 are performed.
Citation Information
Patent Citations
Method for improving OTDR logarithmic computation speed
CN103617148A
Method and device for processing floating-point number
CN105224284A
Abnormal alarm data detection method based on multivariate time series
CN106368813A
Digital image processing chain and processing blocks and a display including the same
CN109074775A
Softmax function approximate calculation method and device
CN115222033A