Integer division operation method and device, medium and equipment

By converting integer data to floating-point data and using a reciprocal arithmetic unit and a multiplier to perform integer division operations, the problem of high cost of integer division operations is solved, achieving efficient and accurate integer division operations and reducing hardware overhead.

CN120848837APending Publication Date: 2025-10-28BEIJING HORIZON INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510947931.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-09
Publication Date
2025-10-28

AI Technical Summary

Technical Problem

In existing technologies, integer division operations are costly to implement at the hardware level. How to achieve efficient and accurate integer division operations while reducing hardware overhead has become an urgent technical problem to be solved.

Method used

Integer division is achieved by converting integer data to floating-point type and using a reciprocal arithmetic unit and a multiplier to perform the operation, thus avoiding the need for a dedicated division circuit.

Benefits of technology

Efficient and accurate integer division operations were achieved while reducing hardware overhead, improving computational efficiency and reducing hardware costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120848837A_ABST
    Figure CN120848837A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an integer division operation method and device, a medium and equipment, and the method comprises the steps: determining first data and second data which is used for carrying out division operation with the first data, and the first data and the second data are of an integer type; performing data type conversion on the first data to obtain floating point type third data; carrying out reciprocal operation on the third data through a reciprocal arithmetic unit to obtain fourth data of a floating point type; and carrying out multiplication operation on the second data and the fourth data through a multiplier so as to determine an operation result obtained by dividing the second data by the first data. According to the embodiment of the invention, integer division operation can be realized through universal hardware such as a reciprocal arithmetic unit and a multiplier, a special division operation circuit is avoided, and the hardware overhead is effectively reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to computer technology, and in particular to a method, apparatus, medium, and device for integer division. Background Technology

[0002] In applications involving massive computation, such as autonomous driving and smart cockpits, division is a critical and common operation. While dedicated hardware circuits exist for implementing integer division, the cost of implementing division at the hardware level is high. Therefore, achieving efficient and accurate integer division while reducing hardware overhead has become a pressing technical challenge. Summary of the Invention

[0003] The embodiments of this disclosure provide an integer division operation method, apparatus, medium, and device to implement integer division operations using general-purpose hardware such as reciprocal operators and multipliers, avoiding the use of dedicated division operation circuits and effectively reducing hardware overhead.

[0004] A first aspect of this disclosure provides an integer division operation method, comprising: determining first data and second data for performing a division operation with the first data, wherein the first data and the second data are integer types; performing data type conversion on the first data to obtain a third data of floating-point type; performing a reciprocal operation on the third data using a reciprocal operator to obtain a fourth data of floating-point type; and performing a multiplication operation on the second data and the fourth data using a multiplier to determine the result of the operation of dividing the second data by the first data.

[0005] A second aspect of this disclosure provides an integer division operation apparatus, comprising: a data determination module for determining first data and second data for performing a division operation with the first data, wherein the first data and the second data are integer types; a type conversion module for converting the data type of the first data to obtain a third data of floating-point type; a first operation module for performing a reciprocal operation on the third data using a reciprocal operator to obtain a fourth data of floating-point type; and a second operation module for performing a multiplication operation on the second data and the fourth data using a multiplier to determine the result of dividing the second data by the first data.

[0006] A third aspect of this disclosure is to provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the integer division operation method described in any of the above embodiments of this disclosure.

[0007] A fourth aspect of this disclosure provides an electronic device, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the integer division operation method described in any of the above embodiments of this disclosure; or, the electronic device comprising an integer division operation apparatus as provided in any of the above embodiments.

[0008] A fifth aspect of this disclosure provides a computer program product that, when instructions in the computer program product are executed by a processor, performs an integer division operation method provided in any of the above embodiments of this disclosure.

[0009] A sixth aspect of this disclosure provides a system-on-a-chip, the system-on-a-chip including: an integer division operation device as provided in any of the above embodiments.

[0010] Based on the integer division operation method, apparatus, medium, and device provided in the above embodiments of this disclosure, for integer division operation, by determining a first data of integer type (which may be called the divisor) and a second data (which may be called the dividend) used to perform the division operation with the first data, the data type of the first data is converted to obtain a third data of floating-point type. Then, by using a reciprocal arithmetic unit of floating-point type, the third data is inversely calculated to obtain a fourth data of floating-point type. Based on the second data and the fourth data, the result of the operation of the second data divided by the first data is determined by a multiplier. Thus, the integer division operation is realized by using a reciprocal arithmetic unit and a multiplier, avoiding the use of a dedicated division operation circuit, thereby achieving efficient and accurate integer division operation while effectively reducing hardware overhead. Attached Figure Description

[0011] Figure 1 This is an exemplary application scenario of the integer division operation method provided in this disclosure;

[0012] Figure 2 This is a flowchart illustrating an exemplary embodiment of the present disclosure of an integer division operation method;

[0013] Figure 3 This is a flowchart illustrating an integer division operation method provided in another exemplary embodiment of this disclosure;

[0014] Figure 4 This is a flowchart of an exemplary embodiment of the present disclosure of an integer division operation method;

[0015] Figure 5 This is a schematic diagram of the structure of an integer division arithmetic device provided in an exemplary embodiment of the present disclosure;

[0016] Figure 6This is a schematic diagram of the structure of an integer division arithmetic device provided in another exemplary embodiment of the present disclosure;

[0017] Figure 7 This is a structural diagram of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0018] To explain this disclosure, exemplary embodiments of the disclosure will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the disclosure, and not all of them. It should be understood that the disclosure is not limited to exemplary embodiments.

[0019] It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps set forth in these embodiments do not limit the scope of this disclosure.

[0020] This disclosure outlines

[0021] In integer division operations, to ensure accuracy, dedicated hardware circuits are typically used to accelerate the process. This requires modifying existing hardware to increase the area and power consumption of the division calculations. Furthermore, dedicated division circuits often have low utilization rates, leading to significant hardware costs. Therefore, achieving efficient and accurate integer division at a lower cost is a pressing technical challenge.

[0022] Exemplary Overview

[0023] Figure 1 This is an exemplary application scenario of the integer division operation method provided in this disclosure. For example... Figure 1As shown, in the on-chip system 10 of intelligent driving, intelligent cockpit, etc., various functions such as perception, planning, and control are often involved. These functions involve a large amount of computation, usually including integer division operations. For example, the perception function may involve downsampling or upsampling images. During downsampling, an integer division operation is involved, dividing the sum of multiple pixel values ​​by the number of pixels. During upsampling, interpolation operations involve integer division operations. Another example is vehicle actuator control, which includes steering angle step control, involving an integer division operation to convert the target angle of the steering wheel into the number of stepper motor pulses. The integer division operation device 20 provided in this embodiment can be used to execute the integer division operation method of this embodiment to achieve the corresponding integer division operation and obtain the calculation result. Specifically, the integer division operation device 20 can determine first data and second data for division with the first data, wherein the first data and the second data are integer types; perform data type conversion on the first data to obtain a floating-point type third data; perform a reciprocal operation on the third data through a reciprocal operator to obtain a floating-point type fourth data; and determine the result of dividing the second data by the first data based on the second data and the fourth data through a multiplier. This embodiment of the present disclosure implements integer division operations through a reciprocal operator and a multiplier, avoiding the use of dedicated division circuits, thus achieving efficient and accurate integer division operations while effectively reducing hardware overhead. The reciprocal operator and the multiplier are hardware circuits in the system-on-a-chip 10. The reciprocal operator and the multiplier can be located within the integer division operation device 20 or outside of it. The integer division operation of this embodiment of the present disclosure is implemented by scheduling these hardware circuits within the integer division operation device 20.

[0024] The integer division method provided in this disclosure is not limited to intelligent driving scenarios. In any other scenario that requires hardware acceleration of integer division, the integer division method of this disclosure can be used to perform integer division operations.

[0025] Exemplary methods

[0026] Figure 2 This is a flowchart illustrating an exemplary embodiment of the integer division method provided in this disclosure. The integer division method provided in this embodiment can be applied to electronic devices and System-on-Chips (SoCs). Electronic devices may include, but are not limited to, in-vehicle terminals, mobile phones, tablets, PCs, servers, etc. SoCs may include, but are not limited to, intelligent driving SoCs, intelligent cockpit SoCs, and SoCs for mobile phones, tablets, etc. The electronic devices and SoCs include reciprocal operators, multipliers, adders, etc. Figure 2 As shown, the integer division operation method of this disclosure embodiment may include the following steps:

[0027] Step 210: Determine the first data and the second data used for division with the first data, wherein the first data and the second data are integer types.

[0028] In this calculation, the first data is the divisor to be divided, and the second data is the dividend to be divided. Both the first and second data are integers, and the division operation is an integer division operation. For example, if the second data is represented as `int a` and the first data is represented as `int b`, the result of the operation `a divided by b` is `c = a / b`.

[0029] In some optional embodiments, the first data and the second data can be physical quantities to be divided by integers in any application scenario. The second data and the first data can be tensor data or scalar data, respectively. For example, if both the first data and the second data are tensor data, integer division operations are performed on multiple elements in the second data with their corresponding elements. Another example is if the second data is tensor data and the first data is scalar data, and integer division operations are performed on multiple elements in the second data with their corresponding elements. Specific application scenarios include, but are not limited to, tensor dimensionality upgrade scenarios, sensor signal parsing scenarios, and actuator control scenarios. For example, in a tensor dimensionality upgrade scenario, a two-dimensional tensor is converted into a three-dimensional tensor. In a two-dimensional tensor, the position of an element is represented as (h1, w1), and after conversion to a three-dimensional tensor, the position of the element is represented as (h2, w2, c). During the conversion process, the two-dimensional tensor is split in the height and / or width directions, thus involving integer division operations. In sensor signal analysis scenarios, signals such as wheel speed, tire pressure, and temperature are typically transmitted in integer form. These require dimensional conversion or calibration offset calculations using integer division, for example, converting wheel speed pulse counts to actual speed. In actuator control scenarios, the first data could be the angle of a single pulse from a stepper motor, and the second data could be the target angle of the steering wheel. The number of pulses is obtained by dividing the target angle by the angle of a single pulse. The specific application scenarios for the first and second data are not limited.

[0030] In some optional embodiments, if one of the divisor and dividend is a floating-point number, and it is necessary to calculate the result of an integer operation, the floating-point number can be converted into an integer number to obtain the first data and the second data suitable for the method of this disclosure embodiment. Then, the result of dividing the second data by the first data can be determined by the method of this disclosure embodiment.

[0031] Step 220: Convert the data type of the first data to obtain the third data of floating-point type.

[0032] Floating-point type is a data type used to represent numerical values ​​with a decimal part. It uses scientific notation to split the data into three parts: sign, mantissa, and exponent, to support numerical operations over a very wide range. Taking FP32 as an example, it includes 1 sign bit, 8 exponent bits, and 23 mantissa bits.

[0033] In some optional embodiments, the first data can be converted to a floating-point type based on the conversion relationship between integer and floating-point types to obtain the third data of floating-point type. The conversion from integer to floating-point type can be achieved in various ways, such as by adding a virtual decimal point after the integer to convert it to a floating-point number; or by using the float function to convert the integer to a floating-point number; for example, the third data can be represented as float bf.

[0034] Step 230: Perform a reciprocal operation on the third data using the reciprocal operator to obtain the fourth data of floating-point type.

[0035] The reciprocal operator is a hardware circuit or software module that supports reciprocal operations on floating-point numbers. The third data, bf, is used as input to the reciprocal operator, which performs a reciprocal operation on the third data to obtain the fourth data, a floating-point number. For example, the fourth data can be represented as float brf, where brf = 1.0 / bf.

[0036] In some alternative embodiments, the reciprocal operator can be implemented using any feasible hardware circuitry. For example, it can be based on multipliers, subtractors, registers, etc., and the reciprocal operation can be implemented through an iterative approximation method. Another example is the implementation of the reciprocal operator using a lookup table (LUT). The specific implementation method of the reciprocal operator is not limited.

[0037] Step 240: Multiply the second data and the fourth data using a multiplier to determine the result of dividing the second data by the first data.

[0038] Among them, the multiplier is a hardware circuit or software functional module that supports multiplication operations.

[0039] In some optional embodiments, a multiplier can be used to perform multiplication on the second and fourth data, convert the result into an integer type, and obtain the current result as the result of dividing the second data by the first data.

[0040] In some optional embodiments, directly using the current calculation result as the result of integer division may result in a large deviation. The reason for the large deviation is that the process of converting the first data into the fourth data involves the reciprocal operation of floating-point numbers, which produces a deviation from the actual value (a / b, i.e., the value of the second data divided by the first data).

[0041] The fourth data, brf, is the result of converting the first data (i.e., the divisor b) to a floating-point value and then performing a reciprocal operation. That is, the fourth data in floating-point type is brf = 1.0 / bf. The reciprocal operation will produce a deviation between 1.0 / bf and 1 / b. The current operation result is an integer result obtained by multiplying the fourth data and the second data a. The operation process also involves the conversion from floating-point number to integer. Floating-point number is a high-precision data type, and integer is a low-precision data type. A certain precision loss will occur during the conversion process. Therefore, there is a deviation between the current operation result and the actual value of a / b. Based on the magnitude of this deviation, it can be determined whether the current operation result is the result of dividing the second data by the first data.

[0042] To further reduce calculation deviations and improve calculation accuracy, step 240 may specifically include: performing multiplication on the second data and the fourth data using a multiplier to obtain the current calculation result; in response to the current calculation result satisfying a third preset condition, using the current calculation result as the result of dividing the second data by the first data; in response to the current calculation result not satisfying the third preset condition, updating the current calculation result based on the current calculation result and the update condition, and using the updated calculation result as the result of dividing the second data by the first data.

[0043] The third preset condition is that the absolute value of the deviation of the current calculation result from the true value is less than a first threshold. This first threshold is determined based on the first data. That is, when the deviation corresponding to the current calculation result meets the third preset condition, the current calculation result can be used as the result of dividing the second data by the first data. The update condition may include that the absolute value of the deviation of the current calculation result from the true value is greater than the first threshold and less than the second threshold (referred to as the first update condition), where the second threshold is twice the first threshold. In response to the current calculation result meeting the update condition, the current calculation result is updated according to the update method corresponding to the update condition. The updated calculation result is used as the result of dividing the second data by the first data. The update method corresponding to the update condition is determined based on the signs of the first and second data.

[0044] For example, the deviation between the current calculation result result and the true value a / b (diff = a / b - result) can be simplified to diff = a - result * b. If the absolute value of diff (which can be represented as abs(diff) or |diff|) is less than the absolute value of b (which can be represented as abs(b) or |b|, i.e. the first threshold mentioned above), it means that the current calculation result meets the third preset condition. Then the current calculation result result is the result of the second data divided by the first data. If the absolute value of diff is greater than or equal to |b| and less than |2b| (i.e. the second threshold), result + 1 or result - 1 can be further determined as the result of the second data divided by the first data based on whether the signs of a and b are the same.

[0045] The integer division method provided in this disclosure determines a first integer data (referred to as the divisor) and a second data (referred to as the dividend) for division with the first data. The first data is then converted to a third floating-point data. A reciprocal operator is used to perform a reciprocal operation on the third data to obtain a fourth floating-point data. Based on the second and fourth data, a multiplier is used to determine the result of dividing the second data by the first data. Thus, integer division is achieved using the reciprocal operator and the multiplier, avoiding the use of a dedicated division circuit. This results in efficient and accurate integer division while effectively reducing hardware overhead.

[0046] In some optional embodiments, step 240, which involves multiplying the second and fourth data using a multiplier to determine the result of dividing the second data by the first data, may include:

[0047] The multiplier performs a multiplication operation on the second and fourth data to obtain the current operation result. In response to the current operation result satisfying the first preset condition, the current operation result is iteratively updated based on the current operation result, the fourth data, and the previous operation result until the current operation result no longer satisfies the first preset condition.

[0048] The first preset condition refers to the absolute value of the deviation corresponding to the current calculation result (i.e., diff = a - result * b) being greater than or equal to the second threshold, i.e., |diff| >= |2b|. If the current calculation result meets the first preset condition, it means that the deviation between the current calculation result and the true value is still relatively large, and the current calculation result needs to be further iterated and updated. The updated calculation result is then used as the result of dividing the second data by the first data. Specifically, the current calculation result is iteratively updated based on the deviation diff corresponding to the current calculation result, the fourth data, and the previous calculation result until the current calculation result no longer meets the first preset condition. The update process can be represented, for example, as result(i) = result(i-1) + float(diff) * brf, where float(diff) represents converting diff to a floating-point number.

[0049] In the embodiments disclosed herein, for cases where the current calculation result has a large deviation, the accuracy of the calculation result is improved through further iterative updates.

[0050] In some alternative embodiments, in the above... Figure 2 Based on the illustrated embodiment, step 230, which involves performing a reciprocal operation on the third data using a reciprocal operator to obtain the fourth data of floating-point type, may include:

[0051] Step 2310: Using a reciprocal calculator, the third data is counted inversely to obtain the fourth data by taking the precision in the first preset direction.

[0052] The first preset direction refers to the direction closer to 0. That is, if two floating-point numbers can represent the fourth data, the floating-point number with the smaller absolute value is used as the fourth data. During the reciprocal operation, a lower-precision floating-point number (e.g., fp16) is typically converted to a higher-precision floating-point number (e.g., fp24) for the reciprocal operation, resulting in a higher-precision reciprocal result. This higher-precision result is then converted back to a lower-precision result. Converting from a higher-precision to a lower-precision floating-point number results in some precision loss. By taking the precision according to the first preset direction, the absolute value of the fourth data is made smaller than the true value of 1 / b. This ensures that the absolute value of the current operation result is always less than or equal to the true value of a / b, and that the sign of the deviation corresponding to the current operation result is consistent with the second data 'a'. This ensures that the magnitude of the deviation can be used to determine whether the current operation result is the result of dividing the second data by the first data.

[0053] In the embodiments of this disclosure, by performing a reciprocal operation on the third data with a precision closer to 0, the absolute value of the reciprocal of the third data is made smaller, ensuring that the sign of the deviation diff = a - result * b is consistent with the second data a, so that the deviation can be used to effectively determine whether result is the result of the operation a / b, thereby improving the calculation accuracy.

[0054] Figure 3 This is a flowchart illustrating an integer division operation method provided in another exemplary embodiment of this disclosure.

[0055] In some alternative embodiments, based on any of the above embodiments, such as Figure 3 As shown, in step 240, a multiplier is used to perform a multiplication operation on the second data and the fourth data to determine the result of dividing the second data by the first data, including:

[0056] Step 2410: In response to the second data satisfying the first preset condition, determine the first deviation of the floating-point type based on the second data.

[0057] The first preset condition is that the second data or the absolute value of the second data is greater than or equal to the aforementioned second threshold. For unsigned integer division, the second threshold is twice the first data, i.e., a >= 2 * b. For signed integer division, the second threshold is twice the absolute value of the first data, i.e., |a| >= |2 * b|. If the second data meets the first preset condition, the second data can be converted into floating-point data as the first deviation.

[0058] In some optional embodiments, the second data is used as the initial deviation. It can be first determined whether the initial deviation meets the first preset condition. If the initial deviation meets the first preset condition, the initial calculation result result(0) can be directly corrected to obtain the result of dividing the second data by the first data, avoiding subsequent iterative calculations and reducing computational load. For example, taking unsigned integer division as an example, the first data b = 3, the second data a = 5, the initial deviation diff = a, diff is less than 2*b, indicating that the initial deviation does not meet the first preset condition, result(0) = 0, diff meets the second preset condition, then the result of a / b is result(0) + 1 = 1. The second preset condition refers to diff or the absolute value of diff being greater than or equal to the first threshold. For unsigned integers, the first threshold is b, and the second preset condition is diff >= b. For signed integers, the first threshold is |b|, and the second preset condition is |diff| >= |b|.

[0059] In some optional embodiments, the second data can be converted to floating-point data according to the conversion relationship between integer type and floating-point type, as the first deviation of floating-point type, which can be represented as diff_f.

[0060] Step 2420: Multiply the first deviation and the fourth data using a multiplier to obtain the first calculation result.

[0061] The first deviation and the fourth data can be multiplied by a floating-point multiplier to obtain the first floating-point result, which can be represented as L1 = diff_f * brf.

[0062] Step 2430: Determine the current calculation result based on the first calculation result and the previous calculation result obtained in the previous iteration.

[0063] Here, the current calculation result represents the approximate calculation result of a / b obtained in the current iteration process. In the initial stage, the previous calculation result is the first preset value. The first preset value is 0, which can be represented as result(0) = 0. The current calculation result can be represented as result(i) = result(i-1) + int(L1), where int(L1) represents the integer type data corresponding to the first calculation result. In the initial stage, when i = 1, result(1) = int(L1), and when i = 2, result(2) = result(1) + int(L1).

[0064] Step 2440: Based on the second data, the current calculation result, and the first data, determine the second deviation of the integer type.

[0065] The second deviation can be determined based on the product of the current calculation result and the first data, as well as the second data, and is expressed as diff2 = a - result(i) * b, where i represents the i-th iteration. Compared to the integer calculation result result(i-1) of the previous iteration, the current calculation result result(i) is closer to the calculation result of a / b. Therefore, the product of the current calculation result and the first data b is closer to the second data a, and the second deviation of the integer type is obtained based on this.

[0066] In step 2450, in response to the second deviation satisfying the first preset condition, a third deviation of the floating-point type is determined based on the second deviation, the first deviation is updated based on the third deviation, and steps 2420 to 2440 are iteratively executed until the second deviation no longer satisfies the first preset condition.

[0067] For unsigned integer division, the first preset condition is that the second deviation is greater than or equal to twice the first data, i.e., diff2 >= 2 * b. For signed integer division, the first preset condition is that the absolute value of the second deviation is greater than or equal to twice the absolute value of the first data, i.e., |diff2| >= |2 * b|. If the second deviation meets the first preset condition, it means that the deviation between a and result(i) * b is large, and result(i) is not yet the accurate result of a / b. Further iteration and updating of the deviation are needed to determine the result of dividing the second data by the first data. Therefore, the second deviation is converted into a floating-point type third deviation to update the first deviation, i.e., diff_f = float(diff2), where float(diff2) represents the floating-point type third deviation. The next iteration is then performed. Taking the (i+1)th iteration as an example, L1 = diff_f * brf, result(i+1) = result(i) + int(L1), and diff2 = a - result(i+1) * b. If diff2 satisfies the first preset condition, diff_f = float(diff2), and the iteration proceeds to the (i+2)th iteration, and so on, until diff2 no ​​longer satisfies the first preset condition. Through iteration, the absolute value of the deviation between the current calculation result (result) and the actual calculation result of a / b gradually decreases, indicating that result gradually approaches the actual calculation result of a / b. Therefore, after the second deviation no longer satisfies the first preset condition, the calculation result of a / b can be determined through simple correction.

[0068] In some optional embodiments, the second deviation can be converted to a floating-point type by taking the precision in the first preset direction, which can be represented as diff_f2.

[0069] Step 2460: In response to the second deviation not meeting the first preset condition, the result of dividing the second data by the first data is determined based on the current calculation result and the second preset condition.

[0070] For unsigned integer division, the second preset condition can be that the second deviation is greater than or equal to the first data b, i.e., diff2>=b. For signed integer division, the second preset condition can be that the absolute value of the second deviation is greater than or equal to the absolute value of the first data b, i.e., |diff2|>=|b|.

[0071] In some optional embodiments, if the second deviation does not meet the first preset condition, it means that the deviation between a and result(i)*b is small. The result of the second data divided by the first data can be determined by simply correcting the current calculation result using the second preset condition. For example, taking signed integer division as an example, if |diff2|<|b|, it means that the second deviation is less than one first data b. Therefore, the current calculation result can be used as the result of a / b. If |diff2|<|2*b| and |diff2|>=|b|, it means that the second deviation is sufficient for one first data b. In this case, for signed integer division, the result of a / b can be further determined based on the signs of the first and second data. For example, if the signs of the first and second data are the same, that is, the sign of the result of a / b is positive, then the sum of the current calculation result and 1 is determined as the result of a / b. If the signs of the first and second data are different, that is, the sign of the result of a / b is negative, then the difference between the current calculation result and 1 is determined as the result of a / b.

[0072] For unsigned integer division, if the second deviation does not satisfy the first preset condition but satisfies the second preset condition (i.e., diff2 < 2 * b and diff2 >= b), the sum of the current result and 1 can be determined as the result of a / b. This avoids calculating absolute values ​​in unsigned integer division, reducing computational load and further saving hardware costs.

[0073] In the embodiments of this disclosure, a first deviation of the floating-point type is determined by the second data, and a first operation result of the floating-point type of the first deviation and the fourth data is determined by the multiplier. Then, based on the first operation result and the previous operation result, the current operation result is determined. Since the current operation result represents an approximate result of the integer division operation obtained through iteration, the second deviation determined based on the current operation result represents the degree of approximation between the current operation result and the actual operation result of a / b. After the second deviation meets a specific condition (i.e., it does not meet the first preset condition but meets the second preset condition), the accurate operation result of a / b can be obtained through simple correction. Thus, by using the reciprocal operator and the multiplier to iteratively approximate the true operation result of a / b, accurate calculation of integer division is achieved, avoiding the use of dedicated integer division circuits and saving hardware overhead. Furthermore, since the reciprocal operator and the multiplier are relatively common hardware in various application scenarios such as intelligent driving and intelligent cockpits, the method of this disclosure can accelerate the processing of integer division operations by calling existing hardware without modifying the hardware architecture, improving the practicality and versatility of the method.

[0074] In some optional embodiments, based on any of the above embodiments, step 2410, based on the second data, determines a first deviation of the floating-point type, including:

[0075] The second data is determined as the initial deviation; the data type of the initial deviation is converted to obtain the first deviation of floating point type.

[0076] Here, the initial deviation represents the deviation of the product of the initial calculation result result(0) and the first data b relative to a. Since no calculation has been performed yet, a is taken as the initial deviation, and the calculation result in the initial stage is set to result(0) = 0. This can be expressed as initializing the deviation diff to the second data, i.e., diff = a.

[0077] In the embodiments of this disclosure, the second data is used as the initial deviation. By converting the second data into a first deviation of floating-point type, the first deviation and the fourth data can be multiplied by a floating-point multiplier, thereby improving the accuracy of the first operation result.

[0078] In some optional embodiments, the method of this disclosure further includes: in response to the second data not satisfying the first preset condition, determining the result of dividing the second data by the first data based on the second data and the second preset condition.

[0079] If the second data does not meet the first preset condition, it means that the deviation of the second data is large, and it is necessary to further determine the result of the second data divided by the first data based on the second data and the second preset condition.

[0080] In some optional embodiments, for signed integer division, if the second data does not satisfy the first preset condition and the second data satisfies the second preset condition, the sign of the operation result can be determined based on the first and second data. If the sign of the operation result is positive, the result of a / b is result(0)+1; if the sign of the operation result of a / b is negative, the result of a / b is result(0)-1. For example, a = -5, b = 3, a is the initial deviation diff = a, |diff| is less than |2*b|, the sign of a is negative, the sign of b is positive, the sign of a / b should be negative, then the result of a / b is result(0)-1 = -1.

[0081] In some optional embodiments, the sign of the result of the a / b operation can be determined by an XOR logic circuit, and then the correction amount for result(0) can be determined based on the sign of the operation result. The correction amount is 1 or -1. The operation logic can be expressed as follows: sign = ((a^b)<0)? -1:1, where a^b represents the bitwise XOR operation, (a^b)<0 means that the sign of the bitwise XOR operation result of a^b is checked, that is, whether the highest bit (sign bit) of the XOR operation result is 1 (trull) or 0 (false), ((a^b)<0)? -1:1 means that if the sign bit of the XOR operation result is 1, it returns -1, that is, sign = -1, and if the sign bit of the XOR operation result is 0, it returns 1, that is, sign = 1. The result of the a / b operation can be expressed as result(0) + sign*1. Where sign = -1 means that the sign of the result of the a / b operation is negative, and sign = 1 means that the sign of the result of the a / b operation is positive. For example, a = 5, which is represented as 0101 in binary, b = 3, which is represented as 0011 in binary, a^b = 0110. By checking that (a^b) < 0, the sign of 0110 is 0, which means it is a positive number, and sign = 1 is returned. The result of the operation a / b is result(0) + 1 = 1.

[0082] In the embodiments of this disclosure, if the second data 'a' used as the dividend satisfies the first preset condition, the calculation result of a / b can be obtained directly based on the second preset condition by correcting the first preset value, thus avoiding the iterative process and further improving the calculation efficiency.

[0083] In some optional embodiments, based on the above embodiments, step 2430, which determines the current calculation result based on the first calculation result and the previous calculation result obtained from the previous iteration, may include:

[0084] The data type of the first operation result is converted to obtain the second operation result of integer type; the second operation result and the previous operation result are added by an adder to obtain the current operation result.

[0085] The first operation result L1 can be converted to an integer type second operation result based on the conversion relationship between integer and floating-point types. The second operation result can be represented as L2 = int(L1). In the initial stage, since the previous operation result is result(0), which is the first preset value, the second operation result L2 represents the approximate value of a / b obtained by approximate calculation using floating-point type. The current operation result is obtained by adding the second operation result and the previous operation result using an adder, which can be represented as result(1) = result(0) + L2. In the subsequent stages of the initial stage, result(i+1) = result(i) + L2. L2 is obtained based on the multiplication result of the updated first deviation and the fourth data. The L2 part is added to the previous result result(i), making result(i+1) closer to the actual result of a / b. Therefore, the current result gradually approaches the actual result of a / b until the second deviation corresponding to the current result does not meet the first preset condition. The result of a / b is obtained by correction, effectively realizing the accurate calculation of integer division and improving the calculation accuracy.

[0086] In some optional embodiments, the data type of the first operation result can be converted according to the precision in a first preset direction to obtain a second operation result of integer type. The first preset direction refers to the direction closer to 0, and the first preset direction is different for different types of integers. For example, for unsigned integer types, the first preset direction is to round down, that is, to the nearest integer. For signed integer types, the first preset direction is determined according to the sign of the first operation result. If the first operation result is positive, the first preset direction is to round down; if the first operation result is negative, the first preset direction is to round up. Rounding up means that when converting floating-point data to integer data, if there are integer data greater than floating-point data and integer data less than floating-point data, the integer data greater than floating-point data is selected as the corresponding integer data for the floating-point data, so that the error of the integer data relative to the floating-point data is positive. Rounding down means that if there are integer data greater than floating-point data and integer data less than floating-point data, the integer data less than floating-point data is selected as the corresponding integer data for the floating-point data, so that the error of the integer data relative to the floating-point data is negative.

[0087] Taking a positive first result and rounding down to the nearest whole number as an example, if the first result is 15.4, then the second result is 15. If the precision is not rounded down to the nearest whole number, the sign of the resulting deviation a-result*b will be uncertain, making it impossible to accurately determine whether result is the result of a / b using diff.

[0088] In this disclosure, the first operation result of the floating-point type is converted into the second operation result of the integer type according to the principle of taking precision closer to 0. This makes the absolute value of the second operation result smaller than the absolute value of the first operation result. Then, the current operation result is determined based on the second operation result and the previous operation result, ensuring that the absolute value of the current operation result is smaller than the true value of a / b. This makes the sign of diff = a - result * b consistent with the sign of a. By using the relationship between diff, b, and 2b, the result of the integer division operation can be effectively determined, thus improving the calculation accuracy.

[0089] In some optional embodiments, based on the above embodiments, step 2440, which determines the second deviation of the integer type based on the second data, the current calculation result, and the first data, may include:

[0090] The product of the current operation result and the first data is determined by an integer multiplier; the difference between the second data and the product is determined by an integer subtractor or adder, and the difference is defined as the second deviation.

[0091] The product of the current calculation result and the first data can be expressed as L3 = result(i) * b. The second deviation can be expressed as diff2 = a - L3 = a - result(i) * b.

[0092] In some alternative embodiments, the integer type multiplier is a hardware circuit capable of supporting integer multiplication operations.

[0093] In some alternative embodiments, the second deviation diff2 can be obtained by subtracting the second data a and L3 using a subtractor.

[0094] In some alternative embodiments, the sign of L3 can be changed first, transforming L3 into -L3, and then an adder can be used to perform an addition operation on -L3 and a to obtain the second deviation diff2.

[0095] In the embodiments of this disclosure, a second deviation is obtained by using a general adder or subtractor and a multiplier. This second deviation represents the deviation between the approximate value of 'a' obtained by floating-point type operation and 'a'. Thus, by using the second deviation and the first preset condition and the second preset condition, it can be determined whether the current operation result is the result of dividing the second data by the first data. In this way, the precise operation of integer division can be achieved by using a general reciprocal operator, adder, subtractor and multiplier, thereby improving the calculation accuracy.

[0096] In some optional embodiments, determining the result of dividing the second data by the first data based on the current calculation result and the second preset condition in step 2460 may include:

[0097] In response to the second deviation satisfying the second preset condition, based on the current operation result and the second preset value, determine the operation result of dividing the second data by the first data; or, in response to the second deviation not satisfying the second preset condition, use the current operation result as the operation result of dividing the second data by the first data.

[0098] Wherein, the second preset value is 1, and the second preset condition is as described above. If the second deviation does not satisfy the second preset condition, it means that the second deviation is less than one first data b, and the current operation result is the operation result of dividing the second data by the first data. For unsigned integer division operations, not satisfying the second preset condition means diff2 < b, or, for signed integer division operations, not satisfying the second preset condition means the absolute value of diff2 is less than the absolute value of b. If the second deviation satisfies the second preset condition, it means that the absolute value of the second deviation contains the absolute value of one first data b. In this case, for unsigned integer division operations, the operation result of dividing the second data by the first data can be determined based on the sum of the current operation result and the second preset value. For signed integer division operations, the operation result of dividing the second data by the first data needs to be determined based on the signs of the first data and the second data, the current operation result, and the second preset value.

[0099] In some optional embodiments, determining the operation result of dividing the second data by the first data based on the current operation result and the second preset value includes: in response to the integer type being an unsigned integer type, determining the sum of the current operation result and the second preset value as the operation result of dividing the second data by the first data. Or, in response to the integer type being a signed integer type, determining the sign type of the operation result of dividing the second data by the first data based on the first data and the second data; determining the operation result of dividing the second data by the first data based on the current operation result, the second preset value, and the sign type of the operation result of dividing the second data by the first data.

[0100] Where the integer type is unsigned integer, it indicates that the current operation is an unsigned integer division operation, and no sign judgment is required. When the second deviation does not meet the first preset condition and the second deviation meets the second preset condition, the sum of the current operation result and the second preset value is the operation result of the second data divided by the first data, that is, the operation result of a / b is result = result(i) + 1, where i indicates that the current iteration is the i-th iteration, and result(i) is the current operation result. If the integer type is signed integer, it indicates that the current operation is a signed integer division operation. When the second deviation does not meet the first preset condition and the second deviation meets the second preset condition, the correction amount of the current operation result is affected by the sign of the operation result, that is, result = result(i) + sign*1, where sign indicates the sign of the operation result, see the aforementioned sign = ((a^b)<0)? -1:1, which will not be repeated here.

[0101] In the embodiments of this disclosure, when the second deviation does not meet the first preset condition and the second deviation meets the second preset condition, the current calculation result is corrected by the second preset value to obtain the accurate calculation result of a / b and improve the calculation accuracy.

[0102] In some alternative embodiments, Figure 4 This is a flowchart of an exemplary embodiment of the present disclosure of an integer division operation method. Figure 4 As shown, the integer division operation method of this disclosure embodiment may include the following steps:

[0103] S41. Determine int a and int b. Where b is the first data and a is the second data.

[0104] S42. Convert b to floating-point type bf (i.e., third data).

[0105] S43. Determine the reciprocal of the floating-point type of bf (i.e., the fourth data) according to the precision in the first preset direction.

[0106] S44. Determine the current calculation result result = 0, and determine the deviation corresponding to the current calculation result diff = a - reault * b.

[0107] S45. Determine whether the absolute value of diff, |diff|, is greater than or equal to (>=) the absolute value of 2*b, |2*b|. That is, determine whether diff satisfies the first preset condition. If |diff|>=|2*b|, continue to S46; if |diff|<|2*b|, end the iteration process and execute S410.

[0108] S46. Determine the first deviation of the floating-point type corresponding to diff, diff_f.

[0109] S47. Based on diff_f and brf, determine the first operation result L1 of the floating-point type: L1 = diff_f * brf.

[0110] S48. Based on L1 and the result of the previous operation, determine the current result. That is, current result = previous result + static_cast <int>(L1), in the initial stage, the result of the previous operation is result(0) = 0. The current result is the current operation result mentioned above.

[0111] S49. Update diff = a - result * b, that is, determine the second deviation. Return to step S45.

[0112] S410. Determine whether the absolute value of diff, |diff|, is greater than or equal to (>=) the absolute value of b, |b|, i.e., determine whether the second deviation meets the second preset condition. If |diff| is greater than or equal to |b|, continue to execute S411; if diff is less than b, jump to S413.

[0113] S411, Determine sign.

[0114] S412, determine whether the result of the operation a / b is result+sign*1 or result+sign. The second preset value is 1.

[0115] S413. Determine the result of the operation a / b as the current operation result. That is, the result of the operation a / b is the current operation result.

[0116] It should be noted that from step S43 to step S413 above, all steps involving approximation operations (such as converting floating-point type to integer type or converting high-precision data to low-precision data) adopt the precision in the first preset direction to ensure that the sign of diff is always the same as the second data a, and to ensure the accuracy and effectiveness of the correction operation after the iteration.

[0117] It should also be noted that, Figure 4 Steps S41 to S413 are applicable to both signed and unsigned integer division operations. Optionally, for unsigned integer division operations, the precision in the first preset direction can be replaced with the precision in the downward direction, the judgment condition in S45 can be replaced with diff>=2*b, the judgment condition in S410 can be replaced with diff>b, and S411 does not need to be executed. S412 is replaced with the result of the operation of a / b being result+1, which can further simplify the operation and reduce additional overhead.

[0118] In the embodiments of this disclosure, the actual result of the integer division operation is iteratively approximated by reciprocal and multiplication operations. When the current deviation diff = a - result * b does not meet the first preset condition, the iteration process exits, and a small-range correction is performed to obtain the actual result of the integer division operation. This allows for the implementation of integer division operations based on general-purpose hardware, reducing hardware overhead. Furthermore, by controlling the precision direction of each step, the sign of diff remains constant. For unsigned integer division, the sign of diff is always positive, ensuring the accuracy and effectiveness of the small-range correction, effectively simplifying the operation and reducing additional overhead. Verification shows that for integer division of int16, the result can be determined through one iteration; for integer division of int32, the actual result is usually approximated through two iterations, and then the result of the integer division operation is obtained through a small-range correction. The integer type is not limited to int16 or int32; the number of iterations required for integer division operations of any integer type can be accurately calculated.

[0119] In some optional embodiments, for various scenarios involving integer division operators, such as intelligent driving and intelligent cockpits, such as integer division operators involved in various neural network models, the integer division operators can be converted into integer division operation methods of the present disclosure by a compiler, so that when the neural network model is deployed to a terminal or system on chip, the integer division operation can be implemented by the general hardware of the system on chip.

[0120] The embodiments described above can be implemented individually or in any combination without conflict. The specific implementation can be set according to actual needs, and this disclosure does not limit them.

[0121] Any of the integer division methods provided in this disclosure can be executed by any suitable electronic device with data processing capabilities, including but not limited to: terminal devices and servers. Alternatively, any of the integer division methods provided in this disclosure can be executed by a processor, such as by a processor executing any of the integer division methods mentioned in this disclosure by calling corresponding instructions stored in memory. Further details will not be elaborated below.

[0122] Exemplary device

[0123] Figure 5 This is a schematic diagram of an integer division operation apparatus provided in an exemplary embodiment of the present disclosure. The apparatus of this embodiment can be used to implement corresponding method embodiments of the present disclosure, such as… Figure 5 The apparatus shown may include: a data determination module 51, a type conversion module 52, a first calculation module 53, and a second calculation module 54.

[0124] The data determination module 51 is used to determine first data and second data for performing a division operation with the first data, wherein the first data and the second data are integers.

[0125] The type conversion module 52 is used to convert the data type of the first data to obtain the third data of floating-point type.

[0126] The first arithmetic module 53 is used to perform a reciprocal operation on the third data to obtain the fourth data of floating-point type through the reciprocal arithmetic unit.

[0127] The second operation module 54 is used to perform multiplication operations on the second data and the fourth data through a multiplier to determine the result of dividing the second data by the first data.

[0128] In some alternative embodiments,

[0129] The first calculation module 53 is specifically used to: perform a reciprocal operation on the third data by taking the precision in the first preset direction through the reciprocal operator to obtain the fourth data.

[0130] Figure 6 This is a schematic diagram of the structure of an integer division arithmetic device provided in another exemplary embodiment of the present disclosure.

[0131] In some alternative embodiments, based on any of the above embodiments, such as Figure 6 As shown, the second arithmetic module 54 may include: a first arithmetic unit 541, a second arithmetic unit 542, a third arithmetic unit 543, a fourth arithmetic unit 544, a fifth arithmetic unit 545, and a sixth arithmetic unit 546.

[0132] The first arithmetic unit 541 is used to determine a first deviation of the floating-point type based on the second data in response to the second data satisfying a first preset condition.

[0133] The second arithmetic unit 542 is used to perform a multiplication operation on the first deviation and the fourth data through a multiplier to obtain the first arithmetic result.

[0134] The third operation unit 543 is used to determine the current operation result based on the first operation result and the previous operation result obtained from the previous iteration.

[0135] The fourth arithmetic unit 544 is used to determine the second deviation of the integer type based on the second data, the current arithmetic result and the first data.

[0136] The fifth arithmetic unit 545 is used to respond to the second deviation satisfying the first preset condition, determine the third deviation of floating-point type based on the second deviation, update the first deviation based on the third deviation, transmit the first deviation to the second arithmetic unit 542, and iteratively execute the steps of multiplying the first deviation and the fourth data through the multiplier to obtain the first operation result and the subsequent steps, until the second deviation no longer satisfies the first preset condition.

[0137] The sixth calculation unit 546, in response to the second deviation not meeting the first preset condition, determines the calculation result of the second data divided by the first data based on the current calculation result and the second preset condition.

[0138] In some optional embodiments, the first arithmetic unit 541 is specifically used for:

[0139] The second data is determined as the initial deviation; the data type of the initial deviation is converted to obtain the first deviation of floating point type.

[0140] In some optional embodiments, the sixth arithmetic unit 546 is further configured to: in response to the second data not satisfying the first preset condition, determine the result of dividing the second data by the first data based on the second data and the second preset condition.

[0141] In some optional embodiments, the third arithmetic unit 543 is specifically used for:

[0142] The data type of the first operation result is converted to obtain the second operation result of integer type; the second operation result and the previous operation result are added by an adder to obtain the current operation result.

[0143] In some optional embodiments, the fourth arithmetic unit 544 is specifically used for:

[0144] The product of the current operation result and the first data is determined by an integer multiplier; the difference between the second data and the product is determined by an integer subtractor or adder, and the difference is defined as the second deviation.

[0145] In some optional embodiments, the sixth arithmetic unit 546 is specifically used for:

[0146] In response to the second deviation satisfying the second preset condition, the result of dividing the second data by the first data is determined based on the current calculation result and the second preset value; or, in response to the second deviation not satisfying the second preset condition, the current calculation result is used as the result of dividing the second data by the first data.

[0147] In some optional embodiments, the sixth arithmetic unit 546 is specifically used for:

[0148] In response to the integer type being unsigned integer, the sum of the current operation result and the second preset value is determined as the result of the second data divided by the first data. Alternatively, in response to the integer type being signed integer, the sign type of the result of the second data divided by the first data is determined based on the first data and the second data; the result of the second data divided by the first data is determined based on the current operation result, the second preset value, and the sign type of the result of the second data divided by the first data.

[0149] In some optional embodiments, each module and unit in the device embodiments of this disclosure can be implemented in any of the following ways: software, hardware circuit, or a combination of software and hardware.

[0150] The embodiments described above can be implemented individually or in any combination without conflict. The specific implementation can be set according to actual needs, and this disclosure does not limit them.

[0151] The beneficial technical effects corresponding to the exemplary embodiments of this device can be found in the corresponding beneficial technical effects of the exemplary method section above, and will not be repeated here.

[0152] Exemplary electronic devices

[0153] Figure 7 This is a structural diagram of an electronic device provided in an embodiment of the present disclosure, including at least one processor 91 and a memory 92.

[0154] The processor 91 may be a central processing unit (CPU) or other form of processing unit with data processing and / or instruction execution capabilities, and may control other components in the electronic device 90 to perform desired functions.

[0155] The memory 92 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 91 may execute one or more computer program instructions to implement the methods and / or other desired functions of the various embodiments of this disclosure described above.

[0156] In one example, the electronic device 90 may also include an input device 93 and an output device 94, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).

[0157] The input device 93 may also include, for example, a touchscreen, a microphone, various sensors, etc. Sensors may include, for example, image sensors (e.g., cameras, webcams), LiDAR, millimeter-wave radar, ultrasonic radar, positioning sensors, pressure sensors, air quality sensors, temperature sensors, etc. Image sensors, LiDAR, millimeter-wave radar, ultrasonic radar, etc., can be used for environmental perception, i.e., detecting moving and static objects in the surrounding environment. Moving and static objects may include, for example, static objects such as lane lines, curbs, arrows, signs, trees, and buildings, as well as dynamic objects such as surrounding vehicles, pedestrians, and cyclists. Positioning sensors are used to locate the mobile device (e.g., a bicycle, a robot, etc.) where the electronic device is located. Positioning sensors may include, for example, an Inertial Measurement Unit (IMU), a Global Positioning System (GPS), etc. Pressure sensors can be used to detect seat pressure. Temperature sensors can be used to detect the temperature inside the vehicle cabin. Air quality sensors can be used to detect the air quality inside the vehicle cabin.

[0158] The output device 94 can output various information to the outside, including, for example, a display, a speaker, a communication network and its connected remote output devices, etc.

[0159] Of course, for the sake of simplicity, Figure 7 Only some of the components of the electronic device 90 relevant to this disclosure are shown, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device 90 may include any other suitable components depending on the specific application.

[0160] In some alternative embodiments, the electronic device 90 includes the integer division operation device provided in any of the above embodiments.

[0161] This disclosure also provides a system-on-a-chip, including the integer division operation device provided in any of the above embodiments.

[0162] Exemplary computer program products and computer-readable storage media

[0163] In addition to the methods and apparatus described above, embodiments of this disclosure may also provide a computer program product, including computer program instructions that, when executed by a processor, cause the processor to perform the steps of the methods in the various embodiments of this disclosure described in the "Exemplary Methods" section above.

[0164] Computer program products can be written in any combination of one or more programming languages ​​to perform the operations of embodiments of this disclosure. These programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0165] Furthermore, embodiments of this disclosure may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps of the methods in the various embodiments of this disclosure described in the "Exemplary Methods" section above.

[0166] Computer-readable storage media may take the form of any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, but is not limited to, systems, apparatuses, or devices that are electrical, magnetic, optical, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0167] The basic principles of this disclosure have been described above with reference to specific embodiments. However, the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.

[0168] Various modifications and variations can be made to this disclosure without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this disclosure and their equivalents, this disclosure is also intended to include such modifications and variations.< / int>

Claims

1. A method for integer division, comprising: Determine a first data and a second data for performing a division operation with the first data, wherein the first data and the second data are integer types; The first data is converted to a data type to obtain the third data of floating-point type; The third data is counted inversely using a reciprocal operator to obtain the fourth data, which is of floating-point type. The second data and the fourth data are multiplied by a multiplier to determine the result of dividing the second data by the first data.

2. The method according to claim 1, wherein, The step of performing a multiplication operation on the second data and the fourth data using a multiplier to determine the result of dividing the second data by the first data includes: In response to the second data satisfying a first preset condition, a first deviation of the floating-point type is determined based on the second data; The first deviation and the fourth data are multiplied using a multiplier to obtain the first calculation result; Based on the first calculation result and the previous calculation result obtained in the previous iteration, the current calculation result is determined; in the initial stage, the previous calculation result is a first preset value; Based on the second data, the current calculation result, and the first data, a second deviation of the integer type is determined; In response to the second deviation satisfying the first preset condition, a third deviation of the floating-point type is determined based on the second deviation, the first deviation is updated based on the third deviation, and the steps of multiplying the first deviation and the fourth data by a multiplier to obtain a first operation result and subsequent steps are executed iteratively until the second deviation no longer satisfies the first preset condition. In response to the second deviation not meeting the first preset condition, the result of dividing the second data by the first data is determined based on the current calculation result and the second preset condition.

3. The method according to claim 2, wherein, The determination of the first deviation of the floating-point type based on the second data includes: The second data is determined as the initial deviation; The initial deviation is converted to a data type to obtain the first deviation as a floating-point type.

4. The method according to claim 2, wherein, Determining the current calculation result based on the first calculation result and the previous calculation result obtained from the previous iteration includes: The data type of the first operation result is converted to obtain the second operation result of integer type; The current operation result is obtained by adding the second operation result and the previous operation result using an adder.

5. The method according to claim 2, wherein, Based on the second data, the current calculation result, and the first data, a second deviation of the integer type is determined, including: The product of the current operation result and the first data is determined using an integer multiplier. The difference between the second data and the product is determined by using an integer type subtractor or adder, and the difference is determined as the second deviation.

6. The method according to claim 2, wherein, Determining the result of dividing the second data by the first data based on the current calculation result and the second preset condition includes: In response to the second deviation satisfying the second preset condition, based on the current calculation result and the second preset value, the result of dividing the second data by the first data is determined; or, In response to the second deviation not meeting the second preset condition, the current calculation result is used as the result of dividing the second data by the first data.

7. The method according to claim 2, wherein, Also includes: In response to the second data not meeting the first preset condition, the result of dividing the second data by the first data is determined based on the second data and the second preset condition.

8. The method according to any one of claims 1-7, wherein, The step of performing a reciprocal operation on the third data to obtain the fourth data of floating-point type includes: The third data is calculated by reciprocal operation using a reciprocal operator, taking the precision in the first preset direction, to obtain the fourth data.

9. An integer division arithmetic device, comprising: A data determination module is used to determine first data and second data for performing a division operation with the first data, wherein the first data and the second data are integers; The type conversion module is used to convert the data type of the first data to obtain the third data of floating-point type; The first arithmetic module is used to perform a reciprocal operation on the third data through a reciprocal arithmetic unit to obtain a fourth data of floating-point type; The second operation module is used to perform a multiplication operation on the second data and the fourth data using a multiplier to determine the result of dividing the second data by the first data.

10. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in any one of claims 1-8.

11. An electronic device, the electronic device comprising: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the method described in any one of claims 1-8.