CN116466910A - Floating point number-based table lookup method and device, electronic equipment and storage medium - Google Patents

Floating point number-based table lookup method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116466910A
CN116466910A CN202310316840.8A CN202310316840A CN116466910A CN 116466910 A CN116466910 A CN 116466910A CN 202310316840 A CN202310316840 A CN 202310316840A CN 116466910 A CN116466910 A CN 116466910A
Authority
CN
China
Prior art keywords
value
divisor
lookup
reciprocal
calculating
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310316840.8A
Other languages
Chinese (zh)
Inventor
于莉莉
郭璟
郭振江
唐璇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Silang Technology Co ltd
Original Assignee
Shanghai Silang Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Silang Technology Co ltd filed Critical Shanghai Silang Technology Co ltd
Priority to CN202310316840.8A priority Critical patent/CN116466910A/en
Publication of CN116466910A publication Critical patent/CN116466910A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/483Computations with numbers represented by a non-linear combination of denominational numbers, e.g. rational numbers, logarithmic number system or floating-point numbers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/491Computations with decimal numbers radix 12 or 20.
    • G06F7/498Computations with decimal numbers radix 12 or 20. using counter-type accumulators
    • G06F7/4983Multiplying; Dividing
    • G06F7/4988Multiplying; Dividing by table look-up
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Nonlinear Science (AREA)
  • Complex Calculations (AREA)

Abstract

The application discloses a floating point number-based table lookup method, a floating point number-based table lookup device, electronic equipment and a storage medium. The method comprises the following steps: obtaining table lookup calculation information, wherein the table lookup calculation information comprises: the divisor is used for looking up a table, and the divisor corresponds to a value interval; acquiring a target lookup table which is created in advance, and determining a lookup value of the target lookup table in a value interval; performing interpolation calculation by using the table lookup value to obtain an interpolation result, and calculating the reciprocal of the divisor based on the interpolation result; and carrying out table lookup based on the calculated result obtained by calculating the reciprocal and the dividend. The divisor is limited to a limited value interval from an infinite range, the table lookup value of the lookup table in the value interval is determined, interpolation fitting is carried out on the table lookup value, the inverse value of the divisor is output through correction and adjustment, the calculation result in any range is obtained by using the method of multiplying the divisor by the inverse of the divisor, the calculation precision is not lost, and the high-precision result of division operation is efficiently calculated.

Description

Floating point number-based table lookup method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of table lookup operations, and in particular, to a table lookup method, apparatus, electronic device, and storage medium based on floating point numbers.
Background
When the division operation is calculated by the conventional table look-up method, the steps adopted are as follows: firstly creating a reciprocal lookup table corresponding to the floating point number, then searching the data of the divisor in the lookup table, performing operations such as interpolation and the like on the searched data to obtain the reciprocal of the divisor, and finally multiplying the divisor by the reciprocal of the divisor to obtain the division operation result. Because the data range of division operation in molecular dynamics simulation is full-range, the size of a table to be created is very large by using the conventional table look-up method, so that the method occupies very large storage space and is difficult to ensure the accuracy of data. In summary, creating a division table to implement division operations in a conventional manner is an inefficient problem.
Disclosure of Invention
In order to solve the technical problems or at least partially solve the technical problems, the application provides a floating point number-based table lookup method, a device, electronic equipment and a storage medium.
According to one aspect of the embodiments of the present application, there is provided a floating point number based lookup method, including:
obtaining table lookup calculation information, wherein the table lookup calculation information comprises: the divisor is used for looking up a table, and the divisor and the value interval corresponding to the divisor are represented by binary streams of floating point numbers;
acquiring a target lookup table which is created in advance, and determining a lookup value of the target lookup table in the value interval;
performing interpolation calculation by using the table lookup value to obtain an interpolation result, and calculating the reciprocal of the divisor based on the interpolation result;
and calculating based on the reciprocal and the dividend to obtain a calculation result.
Further, the obtaining the table look-up calculation information includes:
obtaining preset configuration information for calculating divisor, wherein the preset configuration information comprises: sign bit, step bit, and mantissa bit;
calculating the divisor by using the sign bit, the step bit and the mantissa bit, and calculating a value interval corresponding to the divisor;
and obtaining a preset dividend, and generating table lookup calculation information based on the dividend, the divisor and a value interval corresponding to the divisor.
Further, the calculating the value interval corresponding to the divisor includes:
acquiring an adjustment parameter corresponding to the value range;
adjusting the symbol bit and the step code bit according to the adjustment parameter to obtain an adjusted symbol bit and an adjusted step code bit;
and calculating a value interval corresponding to the divisor based on the adjusted symbol bit and the adjusted step bit.
Further, the determining the table look-up value of the table look-up in the value range includes:
calculating the reciprocal value corresponding to the floating point number in the value range of the lookup table and the difference value of the reciprocal values in the area where each step length is located;
and determining the reciprocal value and the difference value of the reciprocal values as a table look-up value in the value range.
Further, the calculating the difference between the reciprocal value corresponding to the floating point number in the value range and the reciprocal value in the area where each step length is located, includes:
obtaining a product obtained by multiplying the mantissa bit of the divisor by the table length of the lookup table, and determining a reciprocal value corresponding to the floating point number by using the product;
and obtaining the sum of the product and the step length of the lookup table, and calculating the difference value by using the reciprocal value corresponding to the floating point number and the reciprocal value of the sum.
Further, the performing interpolation calculation by using the table lookup value to obtain an interpolation result, and calculating the reciprocal of the divisor based on the interpolation result, including:
performing interpolation calculation by using the table lookup value to obtain an interpolation result;
correcting the interpolation result to obtain a corrected difference result;
and calculating the reciprocal of the divisor based on the corrected difference result.
Further, the calculating, based on the reciprocal and the dividend, obtains a calculation result, including:
calculating a product of the reciprocal and the dividend;
taking the product as the calculation result, and looking up a table by using the product.
According to another aspect of the embodiments of the present application, there is also provided a floating point number based lookup table device, including:
the acquisition module is used for acquiring table lookup calculation information, wherein the table lookup calculation information comprises: the divisor is used for looking up a table, and the divisor and the value interval corresponding to the divisor are represented by binary streams of floating point numbers;
the processing module is used for acquiring a target lookup table which is created in advance and determining a lookup value of the target lookup table in the value interval;
the calculation module is used for carrying out interpolation calculation by utilizing the table lookup value to obtain an interpolation result, and calculating the reciprocal of the divisor based on the interpolation result;
and the execution module is used for calculating and obtaining a calculation result based on the reciprocal and the dividend.
According to another aspect of the embodiments of the present application, there is also provided a storage medium including a stored program that performs the steps described above when running.
According to another aspect of the embodiments of the present application, there is provided an electronic device including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus; wherein: a memory for storing a computer program; and a processor for executing the steps of the method by running a program stored on the memory.
Embodiments of the present application also provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the steps of the above method.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages: according to the method, the divisor is limited to the limited value interval from the infinite range, the table lookup value of the lookup table in the value interval is determined, interpolation fitting is carried out on the table lookup value, the reciprocal value of the divisor is output through correction and adjustment, the calculation result in any range is obtained by using the method that the divisor is multiplied by the reciprocal of the divisor, calculation precision is not lost, and the high-precision result of division operation is calculated efficiently.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the description of the embodiments or the prior art will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a flow chart of a floating point number based lookup method provided in an embodiment of the present application;
FIG. 2 is a schematic diagram of interpolation calculation according to an embodiment of the present application;
FIG. 3 is a block diagram of a floating point number based lookup device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments, the exemplary embodiments of the present application and the descriptions thereof are used to explain the present application and do not constitute undue limitations of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present application based on the embodiments herein.
It should be noted that in this document, relational terms such as "first" and "second" and the like are used solely to distinguish one entity or action from another similar entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The embodiment of the application provides a floating point number-based table lookup method, a floating point number-based table lookup device, electronic equipment and a storage medium. The method provided by the embodiment of the invention can be applied to any needed electronic equipment, for example, the electronic equipment can be a server, a terminal and the like, is not particularly limited, and is convenient to describe and is called as the electronic equipment for short hereinafter.
According to an aspect of the embodiments of the present application, a method embodiment of a floating point number based lookup method is provided, and fig. 1 is a flowchart of a floating point number based lookup method provided in the embodiments of the present application, as shown in fig. 1, where the method includes:
step S11, obtaining table lookup calculation information, wherein the table lookup calculation information comprises: the divisor is used for table lookup, and the dividend and the value interval corresponding to the divisor are represented by binary stream of floating point number.
In an embodiment of the present application, obtaining table lookup calculation information includes: obtaining preset configuration information for calculating divisor, wherein the preset configuration information comprises: sign bit, step bit, and mantissa bit; calculating a divisor by using the sign bit, the step bit and the mantissa bit, and calculating a value interval corresponding to the divisor; and acquiring a preset dividend, and generating table lookup calculation information based on the dividend, the divisor and a value interval corresponding to the divisor.
The binary stream of the floating point number is a floating point binary representation method formed by combining 1-bit sign bit, 11-bit step code bit and 52-bit mantissa bit. In a computer, the floating point number is stored in a manner conforming to the IEEE 754 floating point number count standard, and can be expressed as: S.times.M (1.q). Times.2 E . Therefore, only three dimensional information of sign bit (S), step bit (E), and mantissa bit (m= 1.q) is given, one floating point number is completely represented. Wherein the sign bit S occupies only one bit, 1 represents negative, and 0 represents positive. The step code portion E occupies 11 bits in total and can represent 0,2047 of 10 scale]Since the independent variable range of the index can be a negative number, in order to enable the IEEE 754 floating point number counting standard to represent the number from negative infinity to positive infinity to the maximum extent, the actual index part of the floating point number is usually represented by subtracting 1023 from the code part E, i.e. the value range of the code bit E is [0,2047]Integers in the interval, and the exponent part of the actual floating point number is [ -1023, 1024]. The mantissa portion occupies 52 bits in total, the number is defined as 1 before the decimal point, and storage is not needed, so that all 52 bits are used for storing the number q after the decimal point, and the value interval of the mantissa bit m= 1.q is [1,2 ].
In this embodiment of the present application, calculating a value interval corresponding to a divisor includes: acquiring an adjustment parameter corresponding to the value range; adjusting the symbol bit and the step bit according to the adjustment parameter to obtain an adjusted symbol bit and an adjusted step bit; and calculating a value interval corresponding to the divisor based on the adjusted symbol bit and the adjusted step bit.
Specifically, when calculating the division operation with the dividend y and the divisor x, the multiplication operation may be expressed as a multiplication operation of multiplying the dividend y by the reciprocal of the divisor x. The binary stream of IEEE 754 standard floating-point numbers for divisor x, the divisor x can be expressed as:
x=S×M(1.q)×2 E
wherein. S epsilon {0,1}, M epsilon [1,2 ], E epsilon [0,2047], in the floating point number actually represented, S is positive 1 or negative 1 and represents positive or negative, the mantissa bit is M, and the code bit is E-1023. In order to limit the divisor x to a fixed interval of (0, 1), the following operations are equivalent by adjusting the sign bit and the step bit of the divisor x:
that is, by taking the sign bit S of the IEEE 754 standard floating point number of the divisor x as 0, which is a positive number, the order bit is e+ (1023-E) =1023, and the mantissa bitThe new obtained x It is within the fixed interval of (0, 1). In the floating point number actually represented, new x The sign bit 1 of (2) represents a positive number and the mantissa bit +.>Within the interval (0, 1), the order bits are (E-1023) +(-e+1023) =0, i.e.:
thus new x The value range of (2) is within the value interval (0, 1). I.e. it is achieved that the divisor x is limited to the value interval (0, 1).
Step S12, a pre-created target lookup table is obtained, and the lookup value of the target lookup table in a value interval is determined.
In this embodiment, the lookup table is created in advance, the size of the lookup table is t×2, and the step size is step. In the subsequent table lookup process, the table lookup address can be queried first, and the target table lookup can be found by using the table lookup address, so that the table lookup value in the value interval can be obtained from the target table lookup, for example: the table lookup value may be the reciprocal value corresponding to the floating point number in the (0, 1) range and the difference between the reciprocal values in the region where each step is located.
In the embodiment of the application, determining the table look-up value of the table look-up in the value range includes the following steps A1-A2:
and A1, calculating the reciprocal value corresponding to the floating point number in the value range of the lookup table and the difference value of the reciprocal values in the area where each step length is located.
And A2, determining the reciprocal value and the difference value of the reciprocal values as a table look-up value in a value range.
In this embodiment of the present application, calculating a difference between a reciprocal value corresponding to a floating point number in a value range and two reciprocal values in an area where each step is located in a lookup table includes: obtaining a product obtained by multiplying mantissa bits of the divisor and the table length of the lookup table, and determining a reciprocal value corresponding to the floating point number by using the product; and obtaining the sum of the product and the step length of the lookup table, and calculating a difference value by using the reciprocal value of the reciprocal value and the sum corresponding to the floating point number.
In the embodiment of the application, by combining new x I.e.Multiplying the length T of the table and rounding down to obtain +.>The most recent index value x in the lookup table 0 Thereby, x in the lookup table can be taken out 0 Inverse value of (i.e. y) 0 The method comprises the steps of carrying out a first treatment on the surface of the And x 0 Inverse value of +step minus x 0 The difference of the reciprocal values of (a), y 1 -y 0
And S13, performing interpolation calculation by using the table lookup value to obtain an interpolation result, and calculating the reciprocal of the divisor based on the interpolation result.
In the embodiment of the application, interpolation calculation is performed by using a table lookup value to obtain an interpolation result, and the reciprocal of the divisor is calculated based on the interpolation result, including the following steps B1-B3:
and B1, performing interpolation calculation by using the table lookup value to obtain an interpolation result.
And step B2, correcting the interpolation result to obtain a corrected interpolation result.
And step B3, calculating the reciprocal of the divisor based on the corrected interpolation result.
In the embodiment of the present application, the interpolation calculation process is as follows: let it be assumed that the coordinates (x 0 ,y 0 ) And (x) 1 ,y 1 ) To obtain (x) 1 ,y 1 ) The value of a certain position x in the interval on a straight line can be obtained as shown in fig. 2:
if the value of x is known, then the value of y can be obtained according to the following equation:
thus, the value y fetched in the lookup table according to S202 0 And y 1 -y 0 At a known x 1 -x 0 In the case of =step, according toSubtracting x 0 The difference of +.>Is a precise value of (a).
The IEEE 754 standard floating-point number due to divisor x is expressed as: x=s×m (1.q) ×2 E The actual floating point number is expressed as: x=s×m×2 -E+1022
The actual floating point number of the reciprocal of the divisor x can be expressed as:
based on this, new is obtained x Is the reciprocal of (1) to obtainThe reciprocal of the divisor x can thus be determined by multiplication, i.e. +.>I.e., the inverse of the divisor x obtained by table lookup is multiplied by the sign bit of the divisor x and then multiplied by the power 1022-E of 2. When the reciprocal of divisor x is represented using the IEEE 754 standard floating-point number, the sign bit is identical to divisor x, the step bit is converted from E of divisor x to (-e+1022) +1023=2045-E, and the tail bit is +.>
Step S14, calculating based on the reciprocal and the dividend to obtain a calculation result.
In the embodiment of the present application, performing table lookup based on a calculation result obtained by calculating the reciprocal and the dividend includes: calculating the product of the reciprocal and the dividend; taking the product as a calculation result, and carrying out table lookup by using the product.
In the present embodiment, the calculationCan be calculated by calculating y times +.>Obtaining the product. The calculation method can realize a division operation with high precision using only the basic floating point arithmetic unit function.
According to the embodiment of the application, the divisor is limited to a limited interval (0, 1) from an infinite range, and a high-precision result of division operation is calculated efficiently by writing a calculation mode of a lookup table. Specifically, the divisor is limited in the (0, 1) interval, the table lookup value is calculated, the table lookup value is subjected to interpolation fitting, then the inverse value of the divisor is output through correction and adjustment, and the division operation value in any range is obtained by using the method of multiplying the divisor by the inverse of the divisor, and the calculation precision is not lost.
FIG. 3 is a block diagram of a floating point number based lookup device according to an embodiment of the present application, where the device may be implemented as part or all of an electronic device by software, hardware, or a combination of both. As shown in fig. 3, the apparatus includes:
the obtaining module 31 is configured to obtain table lookup calculation information, where the table lookup calculation information includes: the divisor is used for looking up a table, and the divisor and the value interval corresponding to the divisor are expressed by binary streams of floating point numbers;
the processing module 32 is configured to obtain a target lookup table that is created in advance, and determine a lookup value of the target lookup table in a value interval;
a calculation module 33, configured to perform interpolation calculation using the table lookup value, obtain an interpolation result, and calculate an inverse of the divisor based on the interpolation result;
the execution module 34 is configured to look up a table based on the calculated result of the reciprocal and dividend calculation.
In the embodiment of the present application, the obtaining module 31 is configured to obtain preset configuration information for calculating a divisor, where the preset configuration information includes: sign bit, step bit, and mantissa bit; calculating a divisor by using the sign bit, the step bit and the mantissa bit, and calculating a value interval corresponding to the divisor; and acquiring a preset dividend, and generating table lookup calculation information based on the dividend, the divisor and a value interval corresponding to the divisor.
In the embodiment of the present application, the obtaining module 31 is configured to obtain an adjustment parameter corresponding to the value range; adjusting the symbol bit and the step bit according to the adjustment parameter to obtain an adjusted symbol bit and an adjusted step bit; and calculating a value interval corresponding to the divisor based on the adjusted symbol bit and the adjusted step bit.
In the embodiment of the present application, the processing module 32 is configured to calculate a reciprocal value corresponding to the floating point number in the value range of the lookup table and a difference value between two reciprocal values in the area where each step is located; and determining the reciprocal value and the difference value of the two reciprocal values as a table look-up value in the value range.
In the embodiment of the present application, the processing module 32 is configured to obtain a product obtained by multiplying the mantissa bit of the divisor by the table length of the lookup table, and determine the reciprocal value corresponding to the floating point number by using the product; and obtaining the sum of the product and the step length of the lookup table, and calculating the difference value by using the reciprocal value of the reciprocal value and the sum corresponding to the floating point number.
In the embodiment of the present application, the calculation module 33 is configured to perform interpolation calculation by using the table lookup value to obtain an interpolation result; correcting the interpolation result to obtain a corrected difference result; and calculating the reciprocal of the divisor based on the corrected difference result.
In the embodiment of the present application, the execution module 34 is configured to calculate a product of the reciprocal and the dividend; taking the product as a calculation result, and carrying out table lookup by using the product.
The embodiment of the application further provides an electronic device, as shown in fig. 4, the electronic device may include: the device comprises a processor 1501, a communication interface 1502, a memory 1503 and a communication bus 1504, wherein the processor 1501, the communication interface 1502 and the memory 1503 are in communication with each other through the communication bus 1504.
A memory 1503 for storing a computer program;
the processor 1501, when executing the computer program stored in the memory 1503, implements the steps of the above embodiments.
The communication bus mentioned by the above terminal may be a peripheral component interconnect standard (Peripheral Component Interconnect, abbreviated as PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated as EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the terminal and other devices.
The memory may include random access memory (Random Access Memory, RAM) or non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processing, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment provided herein, a computer readable storage medium having instructions stored therein that when executed on a computer cause the computer to perform the floating point number based lookup method of any of the above embodiments is also provided.
In yet another embodiment provided herein, there is also provided a computer program product containing instructions that, when run on a computer, cause the computer to perform the floating point number based lookup method of any of the above embodiments.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk), etc.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the present application. Any modifications, equivalent substitutions, improvements, etc. that are within the spirit and principles of the present application are intended to be included within the scope of the present application.
The foregoing is merely a specific embodiment of the application to enable one skilled in the art to understand or practice the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A floating point number based lookup method, comprising:
obtaining table lookup calculation information, wherein the table lookup calculation information comprises: the divisor is used for looking up a table, and the divisor and the value interval corresponding to the divisor are represented by binary streams of floating point numbers;
acquiring a target lookup table which is created in advance, and determining a lookup value of the target lookup table in the value interval;
performing interpolation calculation by using the table lookup value to obtain an interpolation result, and calculating the reciprocal of the divisor based on the interpolation result;
and calculating based on the reciprocal and the dividend to obtain a calculation result.
2. The method of claim 1, wherein the obtaining look-up table calculation information comprises:
obtaining preset configuration information for calculating divisor, wherein the preset configuration information comprises: sign bit, step bit, and mantissa bit;
calculating the divisor by using the sign bit, the step bit and the mantissa bit, and calculating a value interval corresponding to the divisor;
and obtaining a preset dividend, and generating table lookup calculation information based on the dividend, the divisor and a value interval corresponding to the divisor.
3. The method according to claim 2, wherein the calculating the value interval corresponding to the divisor includes:
acquiring an adjustment parameter corresponding to the value range;
adjusting the symbol bit and the step code bit according to the adjustment parameter to obtain an adjusted symbol bit and an adjusted step code bit;
and calculating a value interval corresponding to the divisor based on the adjusted symbol bit and the adjusted step bit.
4. The method of claim 2, wherein determining the look-up table value of the look-up table within the range of values comprises:
calculating the reciprocal value corresponding to the floating point number in the value range of the lookup table and the difference value of the reciprocal values in the area where each step length is located;
and determining the reciprocal value and the difference value of the reciprocal values as a table look-up value in the value range.
5. The method of claim 4, wherein calculating a difference between a reciprocal value corresponding to the floating point number in the range of values and two reciprocal values in the region of each step size of the lookup table comprises:
obtaining a product obtained by multiplying the mantissa bit of the divisor by the table length of the lookup table, and determining a reciprocal value corresponding to the floating point number by using the product;
and obtaining the sum of the product and the step length of the lookup table, and calculating the difference value by using the reciprocal value corresponding to the floating point number and the reciprocal value of the sum.
6. The method of claim 1, wherein interpolating using the table look-up value to obtain an interpolation result, and calculating the inverse of the divisor based on the interpolation result, comprises:
performing interpolation calculation by using the table lookup value to obtain an interpolation result;
correcting the interpolation result to obtain a corrected difference result;
and calculating the reciprocal of the divisor based on the corrected difference result.
7. The method of claim 6, wherein the calculating based on the reciprocal and the dividend comprises:
calculating a product of the reciprocal and the dividend;
taking the product as the calculation result, and looking up a table by using the product.
8. A floating point number based lookup device, comprising:
the acquisition module is used for acquiring table lookup calculation information, wherein the table lookup calculation information comprises: the divisor is used for looking up a table, and the divisor and the value interval corresponding to the divisor are represented by binary streams of floating point numbers;
the processing module is used for acquiring a target lookup table which is created in advance and determining a lookup value of the target lookup table in the value interval;
the calculation module is used for carrying out interpolation calculation by utilizing the table lookup value to obtain an interpolation result, and calculating the reciprocal of the divisor based on the interpolation result;
and the execution module is used for calculating and obtaining a calculation result based on the reciprocal and the dividend.
9. A storage medium comprising a stored program, wherein the program when run performs the method steps of any of the preceding claims 1 to 7.
10. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus; wherein:
a memory for storing a computer program;
a processor for executing the method steps of any one of claims 1 to 7 by running a program stored on a memory.
CN202310316840.8A 2023-03-28 2023-03-28 Floating point number-based table lookup method and device, electronic equipment and storage medium Pending CN116466910A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310316840.8A CN116466910A (en) 2023-03-28 2023-03-28 Floating point number-based table lookup method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310316840.8A CN116466910A (en) 2023-03-28 2023-03-28 Floating point number-based table lookup method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116466910A true CN116466910A (en) 2023-07-21

Family

ID=87178085

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310316840.8A Pending CN116466910A (en) 2023-03-28 2023-03-28 Floating point number-based table lookup method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116466910A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117149133A (en) * 2023-09-05 2023-12-01 上海合芯数字科技有限公司 Floating point division and square root operation circuit lookup table construction method and operation method
CN117746867A (en) * 2024-02-19 2024-03-22 深圳市友杰智新科技有限公司 Speech recognition acceleration method, device and equipment
CN117746838A (en) * 2024-02-19 2024-03-22 深圳市友杰智新科技有限公司 Speech feature extraction acceleration method, device, equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117149133A (en) * 2023-09-05 2023-12-01 上海合芯数字科技有限公司 Floating point division and square root operation circuit lookup table construction method and operation method
CN117149133B (en) * 2023-09-05 2024-05-24 上海合芯数字科技有限公司 Floating point division and square root operation circuit lookup table construction method and operation method
CN117746867A (en) * 2024-02-19 2024-03-22 深圳市友杰智新科技有限公司 Speech recognition acceleration method, device and equipment
CN117746838A (en) * 2024-02-19 2024-03-22 深圳市友杰智新科技有限公司 Speech feature extraction acceleration method, device, equipment and storage medium
CN117746838B (en) * 2024-02-19 2024-05-24 深圳市友杰智新科技有限公司 Speech feature extraction acceleration method, device, equipment and storage medium
CN117746867B (en) * 2024-02-19 2024-05-24 深圳市友杰智新科技有限公司 Speech recognition acceleration method, device and equipment

Similar Documents

Publication Publication Date Title
CN116466910A (en) Floating point number-based table lookup method and device, electronic equipment and storage medium
US11249721B2 (en) Multiplication circuit, system on chip, and electronic device
CN110888623B (en) Data conversion method, multiplier, adder, terminal device and storage medium
CN111310890A (en) Deep learning model optimization method and device and terminal equipment
CN113296732B (en) Data processing method and device, processor and data searching method and device
US9798520B2 (en) Division operation apparatus and method of the same
US20040167956A1 (en) Method and apparatus for executing division
EP3769208A1 (en) Stochastic rounding logic
CN107992284B (en) Method for realizing division function of programmable device
CN111813371A (en) Floating-point division operation method, system and readable medium for digital signal processing
CN114819159A (en) Inference method, device, equipment and storage medium of deep learning model
AU2017330184A1 (en) Piecewise polynomial evaluation instruction
Chen High‐order Taylor series approximation for efficient computation of elementary functions
CN115827555B (en) Data processing method, computer device, storage medium, and multiplier structure
CN105302520B (en) Reciprocal operation solving method and reciprocal operation solving system
CN111384971B (en) Method, device and decoder for processing data in finite field
CN116166217A (en) System and method for performing floating point operations
CN115686436A (en) Method and device for calculating fixed point division
JP2020067897A (en) Arithmetic processing unit, learning program, and learning method
CN114117063A (en) Entity alignment method, device, electronic equipment and computer readable storage medium
CN116186471A (en) Index function-based table lookup method and device, electronic equipment and storage medium
JP5305392B2 (en) IQ data square sum route calculation means
Yuan et al. FPGA based implementation of low-latency floating-point exponential function
CN1936830A (en) Digital realization for exponentiation of decimal fraction
WO2022047873A1 (en) Division operation method and apparatus, electronic device, and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination