CN1677308A - Logarithmic Transformation Method and Device - Google Patents
Logarithmic Transformation Method and Device Download PDFInfo
- Publication number
- CN1677308A CN1677308A CN 200410033338 CN200410033338A CN1677308A CN 1677308 A CN1677308 A CN 1677308A CN 200410033338 CN200410033338 CN 200410033338 CN 200410033338 A CN200410033338 A CN 200410033338A CN 1677308 A CN1677308 A CN 1677308A
- Authority
- CN
- China
- Prior art keywords
- mantissa
- unit
- coefficient
- mth
- temp
- 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.)
- Granted
Links
- 238000011426 transformation method Methods 0.000 title claims 5
- 238000006243 chemical reaction Methods 0.000 claims abstract description 37
- 238000000034 method Methods 0.000 claims abstract description 29
- 230000000875 corresponding effect Effects 0.000 claims 1
- 230000009466 transformation Effects 0.000 claims 1
- 230000001052 transient effect Effects 0.000 description 12
- 238000004364 calculation method Methods 0.000 description 11
- 238000010586 diagram Methods 0.000 description 2
- 238000002940 Newton-Raphson method Methods 0.000 description 1
Images
Landscapes
- Complex Calculations (AREA)
Abstract
The invention provides a logarithmic conversion method for a digital processing unit. The logarithm conversion method is to convert a number x to be processed into a logarithm L with a base b, and the logarithm L includes a characteristic number In and a mantissa number Ma. The logarithmic conversion method represents all numbers in fixed-point format. The logarithmic conversion method comprises the following steps. Specifying an exact number of bits k required by the mantissa Ma. And establishing a plurality of parameter tables by using the base number b, wherein the number of the parameter tables is equal to the accurate digit number k. The mth of the plurality of parameter tables is a value of the mth bit of the supply and demand mantissa Ma which is equal to or less than the decimal point. The characteristic In is calculated. And sequentially searching a plurality of parameter tables to obtain the values of the 1 st to k th bits of the mantissa Ma below the decimal point.
Description
Technical field
The present invention relates to a kind of logarithm conversion method and device thereof.
Background technology
Carry out digital signal processing and pending number must be transferred to logarithm (logarithm) often.General execution has following method to number conversion.One is with floating-point (floating-point) form shfft registration word, and with power series (power series) or newton-Rui Fu think of a way (Newton-Raphson method) approach the result.Also can table look-up in addition, or only calculate first number (integer) part, and ignore mantissa (mantissa).
So utilize floating-point format to represent numeral, and very complicated in the think of a way mode of approaching the result of power series or newton-Rui Fu, and expend time in and hardware resource.And use the hardware of fixed point format expensive with software emulation floating-point format computing also difficulty.Look-up table is to build up a table of logarithm earlier, if require accurate figure place height, and then must huge form and take huge memory headroom.And it is accurate inadequately only to calculate first number.Therefore need a kind of enough accurate simply again logarithm conversion method and device.
Summary of the invention
Fundamental purpose of the present invention is providing a kind of enough accurate simply again logarithm conversion method and device.The present invention looks the required accurate figure place of mantissa and sets up and the identical parameter list of required accurate figure place number, and m table can be used for asking for the m position of mantissa below radix point.The present invention is simple because of being that lookup table mode utilizes floating-point format to represent that numeral is approached result's mode again.The number of parameter list is decided according to required accurate figure place, and can be as the meaningless memory headroom that expends of lookup table mode.It is accurate to specify in addition accurate figure place also more only to calculate the mode of first number according to need.
The invention provides a kind of logarithm conversion method that is used for a digital processing element.It is a logarithm L at the end that this logarithm conversion method system is converted to pending several x with a truth of a matter b, and logarithm L comprises a first number In and a Ma of mantissa.The logarithm conversion method is represented all numerals with fixed point format.The logarithm conversion method comprises the following step.An accurate figure place k who specifies the Ma of mantissa to require.Utilize truth of a matter b to set up a plurality of parameter lists, the number of a plurality of parameter lists equals accurate figure place k.The m of a plurality of parameter lists is the value that supply and demand are got the m position of the Ma of mantissa below radix point.Calculate first number In.And search a plurality of parameter lists in regular turn, to get the value of the Ma of mantissa the 1st to k position below radix point.
Aforementioned calculation procedure can comprise following steps.Seek the y power that a digital y makes truth of a matter b and be not more than pending several x, and (y+1) power of truth of a matter b is greater than pending several x.And export number In headed by the digital y.
Aforementioned each parameter list can have 10 projects.Aforementioned establishment step can comprise the following step.Be the individual coefficient S C that determines of the m of a plurality of parameter lists
mAnd the n power of truth of a matter b opened 10
mThe power radical sign multiply by coefficient S C again
m, as m n project of a plurality of parameter lists, n=0 ..., 9.Coefficient S C wherein
mSystem is for the spacing that widens 10 projects.Coefficient S C
mCan be 2 power series (power series).
Aforementioned finding step can comprise the following step.Set m and equal 1.If m=1 removes among pending several x, the part that first number In constitutes multiply by coefficient S C again
mTo get a temporary transient number Temp.Otherwise remove among pending several x, first number In and the Ma of mantissa the 1st part that constitutes to (m-1) position below radix point multiply by coefficient S C again
mTemporarily count Temp to get.Seek m n project Tab of a plurality of parameter lists
m[n] makes Tab
m[n] is not more than temporary transient several Temp, and Tab
m[n+1] is greater than temporary transient number Temp.Output n is the m position of the Ma of mantissa below radix point.M is added 1.Relatively m and accurately figure place k.And if m is not more than accurate figure place k, double counting is temporarily counted Temp to relatively m and the accurately step of figure place k.
It is a kind of to analog-to-digital conversion apparatus that the present invention also provides, and is a logarithm L at the end for pending several x are converted to a truth of a matter b.Logarithm L comprises a first number In and a Ma of mantissa.Analog-to-digital conversion apparatus is represented all numerals with fixed point format.Analog-to-digital conversion apparatus is comprised a specified device, an apparatus for establishing, a calculation element and search device.Specified device is for an accurate figure place k who specifies the Ma of mantissa to require.Apparatus for establishing is for utilizing truth of a matter b to set up a plurality of parameter lists.The number of a plurality of parameter lists equals accurate figure place k.The m of a plurality of parameter lists is that supply and demand are got the m position of the Ma of mantissa below radix point.Calculation element is for calculating first number In.Search device for searching a plurality of parameter lists in regular turn, to get 1st to the k position of the Ma of mantissa below radix point.
Aforementioned calculation element can comprise one first and seek unit and one first output unit.First seeks the unit makes the y power of truth of a matter b be not more than pending several x for seeking a digital y, and (y+1) power of truth of a matter b is greater than pending several x.First output unit is counted In headed by the digital y of output.
Aforementioned each parameter list can have 10 projects.Aforementioned apparatus for establishing can comprise a decision unit and one first arithmetic element.The decision unit is for being the individual coefficient S C that determines of the m of a plurality of parameter lists
mFirst arithmetic element is for the n power of truth of a matter b is opened 10
mThe power radical sign multiply by coefficient S C again
m, as m n project of a plurality of parameter lists, n=0 ..., 9.Coefficient S C wherein
mBe for the spacing that widens 10 projects.Coefficient S C
mCan be 2 power series.
The aforementioned device of searching can comprise a setup unit, one second arithmetic element, one second searching unit, one second output unit, an adder unit, a comparing unit and a logical block.Setup unit equals 1 for setting m.If m=1, second arithmetic element is for removing among pending several x, and the part that first number In constitutes multiply by coefficient S C again
mTo get a temporary transient number Temp.Otherwise second arithmetic element is for removing among pending several x, and first number In and the Ma of mantissa the 1st part that constitutes to (m-1) position below radix point multiply by coefficient S C again
mTemporarily count Temp to get.Second seeks the unit for n individual project Tab of the m that seeks a plurality of parameter lists
m[n] makes Tab
m[n] is not more than temporary transient several Temp, and Tab
m[n+1] is greater than temporary transient number Temp.Second output unit is the m position of the Ma of mantissa below radix point for output n.Adder unit is for m is added 1.Comparing unit is for relatively m and accurately figure place k.If m is not more than accurate figure place k, logical block is sought unit, second output unit, adder unit and comparing unit for indication second arithmetic element, second and is repeated pairing action in regular turn.
The accompanying drawing summary
Fig. 1 is the process flow diagram of logarithm conversion method one embodiment of the present invention;
Fig. 2 is that the present invention is to analog-to-digital conversion apparatus one embodiment calcspar; And
Fig. 3 is parameter list one embodiment of the present invention.
The reference numeral explanation
200 pairs of analog-to-digital conversion apparatus embodiment 202 specified devices
204 apparatus for establishing, 206 decision unit
208 first arithmetic elements, 210 calculation elements
212 first seek unit 214 first output units
216 search device 218 setup units
220 second arithmetic elements 222 second are sought the unit
224 second output units, 226 adder units
228 comparing units, 230 logical blocks
Embodiment
Fig. 1 is the process flow diagram of logarithm conversion method one embodiment of the present invention.This logarithm conversion method embodiment is used for a digital processing element, is a logarithm L at the end for pending several x are converted to a truth of a matter b.Logarithm L comprises a first number In and a Ma of mantissa.The logarithm conversion method is represented all numerals with fixed point format.
This logarithm conversion method embodiment comprises the following step.An accurate figure place k (step 101) who specifies the Ma of mantissa to require.Utilize truth of a matter b to set up a plurality of parameter lists, the number of a plurality of parameter lists equals accurate figure place k.The m of a plurality of parameter lists is the value that supply and demand are got the m position of the Ma of mantissa below radix point.Each parameter list can have 10 projects.Aforementioned establishment step can comprise the following step.Be the individual coefficient S C that determines of the m of a plurality of parameter lists
m(step 103).The coefficient of each parameter list can be different.Coefficient S C
mBe for widening the spacing of 10 projects, if spacing is enough, but also SC
m=1.Coefficient S C
mCan be 2 power series, the computing in the time of so can making things convenient for numeral to represent with 2 carries.Then the n power of truth of a matter b is opened 10
mThe power radical sign multiply by coefficient S C again
m, as m n project of a plurality of parameter lists, n=0 ..., 9 (steps 105).
Other calculates first number In.This calculation procedure can comprise following steps.Seek the y power that a digital y makes truth of a matter b and be not more than pending several x, and (y+1) power of truth of a matter b is greater than pending several x (step 107).And export number In (step 109) headed by the digital y.
Then search a plurality of parameter lists in regular turn, to get the value of the Ma of mantissa the 1st to k position below radix point.This finding step can comprise the following step.Set m and equal 1 (step 111).If m=1 removes among pending several x, the part that first number In constitutes multiply by coefficient S C again
mTo get a temporary transient number Temp.Otherwise remove among pending several x, first number In and the Ma of mantissa the 1st part that constitutes to (m-1) position below radix point multiply by coefficient S C again
mTemporarily count Temp (step 113) to get.Seek m n project Tab of a plurality of parameter lists
m[n] makes Tab
m[n] is not more than temporary transient several Temp, and Tab
m[n+1] is greater than temporary transient number Temp (step 115).Output n is the m position (step 117) of the Ma of mantissa below radix point.M is added 1 (step 119).Relatively m and accurately figure place k (step 121).If m is not more than accurate figure place k, double counting is temporarily counted Temp to relatively m and the accurately step (step 113-121) of figure place k.If m is greater than k, then exportable before the figure place (step 123) that below radix point, requires of the Ma of gained mantissa.Aforementioned searching Tab
mThe step (step 115) of [n] can have many modes, for example begins the comparison size by the 0th project, or begins the comparison size by the 4th or the 5th project.
Though aforementioned establishment step (step 103-105) is prior to calculation procedure (step 107-109), but so also calculation procedure (step 107-109) is prior to establishment step (step 103-105), or both carry out simultaneously.
Fig. 2 is the calcspar of the present invention to analog-to-digital conversion apparatus one embodiment 200.Is a logarithm L at the end to analog-to-digital conversion apparatus embodiment 200 for pending several x are converted to a truth of a matter b.Logarithm L comprises a first number In and a Ma of mantissa.This embodiment 200 represents all numerals with fixed point format.This embodiment 200 comprises a specified device 202, an apparatus for establishing 204, a calculation element 210 and and searches device 216.
Specified device 202 is for an accurate figure place k who specifies the Ma of mantissa to require.Apparatus for establishing 204 is for utilizing truth of a matter b to set up a plurality of parameter lists.The number of a plurality of parameter lists equals accurate figure place k.The m of a plurality of parameter lists is that supply and demand are got the m position of the Ma of mantissa below radix point.Aforementioned each parameter list can have 10 projects.Apparatus for establishing 204 comprises a decision unit 206 and one first arithmetic element 208.Decision unit 206 is for being the individual coefficient S C that determines of the m of a plurality of parameter lists
mThe coefficient of each parameter list can be different.Coefficient S C
mBe for widening the spacing of 10 projects, if spacing is enough, but also SC
m=1.Coefficient S C
mCan be 2 power series, the computing in the time of so can making things convenient for numeral to represent with 2 carries.First arithmetic element 208 is for the n power of truth of a matter b is opened 10
mThe power radical sign multiply by coefficient S C again
m, as m n project of a plurality of parameter lists, n=0 ..., 9.
Calculation element 210 is for calculating first number In.Calculation element 210 can comprise one first and seek unit 212 and one first output unit 214.First seeks unit 212 makes the y power of truth of a matter b be not more than pending several x for seeking a digital y, and (y+1) power of truth of a matter b is greater than pending several x.First output unit 214 is counted In headed by the digital y of output.
Search device 216 for searching a plurality of parameter lists in regular turn, to get 1st to the k position of the Ma of mantissa below radix point.Search device 216 and can comprise a setup unit 218, one second arithmetic element 220, one second searching unit 222, one second output unit 224, an adder unit 226, a comparing unit 228 and a logical block 230.Setup unit 218 equals 1 for setting m.If m=1, second arithmetic element 220 is for removing among pending several x, and the part that first number In constitutes multiply by coefficient S C again
mTo get a temporary transient number Temp.Otherwise second arithmetic element 220 is for removing among pending several x, and first number In and the Ma of mantissa the 1st part that constitutes to (m-1) position below radix point multiply by coefficient S C again
mTemporarily count Temp to get.Second seeks unit 222 for n individual project Tab of the m that seeks a plurality of parameter lists
m[n] makes Tab
m[n] is not more than temporary transient several Temp, and Tab
m[n+1] is greater than temporary transient number Temp.Second output unit 224 is the m position of the Ma of mantissa below radix point for output n.Adder unit 226 is for m is added 1.Comparing unit 228 is for relatively m and accurately figure place k.If m is not more than accurate figure place k, logical block 230 is sought unit 222, second output unit 224, adder unit 226 and comparing unit 228 for indication second arithmetic element 220, second and is repeated pairing action in regular turn.Aforementioned second seeks unit 222 seeks Tab
m[n] can have many modes, for example begins the comparison size by the 0th project, or begins the comparison size by the 4th or the 5th project.
Below illustrate the running of logarithm conversion method of the present invention and device.Suppose that pending several x equal 135, truth of a matter b equals 10.The accurate figure place k that at first specifies the Ma of mantissa to require equals 3.Next can set up parameter list simultaneously and calculate first number In, or set up parameter list earlier and calculate first number In again, otherwise or.Hypothesis is set up parameter list earlier herein.Please refer to Fig. 3, Fig. 3 is a parameter list embodiment.Owing to require accurate figure place k to equal 3, so set up 3 parameter lists.The 1st parameter list supply and demand are got the Ma of mantissa below radix point the 1st, and the rest may be inferred by analogy.Each parameter list all has 10 projects.Coefficient S C for these 3 parameter list decisions
1-SC
3All be 4096.0 power of the truth of a matter 10 is opened 10
1Radical sign is taken advantage of SC again
1, promptly 10
0.0* 4096, as the 0th project Tab of the 1st parameter list
1[0]; 1 power of the truth of a matter 10 is opened 10
1Radical sign is taken advantage of SC again
1, promptly 10
0.1* 4096, as the 1st project Tab of the 1st parameter list
1[1], the rest may be inferred by analogy.
Then calculate first number In.We can find a digital y to equal 2, make the y power of truth of a matter b (=10) be not more than pending several x (=135), and (y+1) power of truth of a matter b is greater than pending several x, and promptly 10
2≤ 135<10
(2+1), then first number In equals 2.
Then search parameter list to ask for the Ma of mantissa.
* set m=1
* m=1 then removes among the x (=135), and the part that In (=2) constitutes multiply by SC again
1(=4096) are to get Temp; Temp=135 * 4096/10 then
2=5529.6
* search Tab
1, find n=1 to make Tab
1[1]≤Temp<Tab
1[2], promptly 5157≤5529.6<6492
* exporting n (=1) is Ma[1], i.e. Ma[1]=1
* with m+1, i.e. m=2
* compare m (=2) and k (=3)
* m≤k, promptly 2≤3, then repeat to ask for Temp to the relatively action of m and k
* m=2 then removes among the x (=135) In (=2) and Ma[1] part that (=1) constitutes, multiply by SC again
2(=4096) are to get Temp; Temp=135 * 4096/10 then
2.1 4392
* search Tab
2, find n=3 to make Tab
2[3]≤Temp<Tab
2[4], promptly 4389≤4392<4491
* exporting n (=3) is Ma[2], i.e. Ma[2]=3
* with m+1, i.e. m=3
* compare m (=3) and k (=3)
* m≤k, promptly 3≤3, then repeat to ask for Temp to the relatively action of m and k
* m=3 then removes among the x (=135) In (=2), Ma[1] (=1) and Ma[2] part that (=3) constitute, multiply by SC again
3(=4096) are to get Temp; Temp=135 * 4096/10 then
2.13 4099
* search Tab
3, find n=0 to make Tab
3[0]≤Temp<Tab
3[1], promptly 4096≤4099<4105
* exporting n (=0) is Ma[3], i.e. Ma[3]=0
* with m+1, i.e. m=4
* compare m (=4) and k (=3)
* m>k, promptly 4>3, tenth skill then, the Ma=0.130 of mantissa
Then obtaining first number In at last is 2, and the Ma of mantissa is 0.130, and then logarithm L is 2.130, i.e. log
10X=log
10135 2.130.
Above-mentioned explanation is not the restriction to category of the present invention, and the arrangement of above-mentioned explanation and various change and isotropism is all in the category that the present patent application claim is intended to protect.
Claims (12)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2004100333383A CN100340940C (en) | 2004-04-02 | 2004-04-02 | Logarithmic Transformation Method and Device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2004100333383A CN100340940C (en) | 2004-04-02 | 2004-04-02 | Logarithmic Transformation Method and Device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1677308A true CN1677308A (en) | 2005-10-05 |
CN100340940C CN100340940C (en) | 2007-10-03 |
Family
ID=35049851
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2004100333383A Expired - Fee Related CN100340940C (en) | 2004-04-02 | 2004-04-02 | Logarithmic Transformation Method and Device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100340940C (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102436365A (en) * | 2010-12-20 | 2012-05-02 | 中国电子科技集团公司第四十一研究所 | Method and device for converting high-speed linear spectrum data into logarithmic data |
CN103455302A (en) * | 2012-05-31 | 2013-12-18 | 上海华虹集成电路有限责任公司 | Circuit for realizing logarithm operation by using hardware |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4626825A (en) * | 1985-07-02 | 1986-12-02 | Vlsi Technology, Inc. | Logarithmic conversion apparatus |
SE470542B (en) * | 1992-12-07 | 1994-07-25 | Foersvarets Forskningsanstalt | Device for converting a binary floating point into a 2 logarithm in binary form or vice versa |
US5604691A (en) * | 1995-01-31 | 1997-02-18 | Motorola, Inc. | Logarithm/inverse-logarithm converter utilizing a truncated Taylor series and method of use thereof |
US5703801A (en) * | 1995-01-31 | 1997-12-30 | Motorola, Inc. | Logarithm/inverse-logarithm converter utilizing second-order term and method of using same |
JP3110288B2 (en) * | 1995-07-21 | 2000-11-20 | 日本電気株式会社 | Exponential logarithmic conversion circuit |
US6182100B1 (en) * | 1998-06-30 | 2001-01-30 | International Business Machines Corporation | Method and system for performing a logarithmic estimation within a data processing system |
-
2004
- 2004-04-02 CN CNB2004100333383A patent/CN100340940C/en not_active Expired - Fee Related
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102436365A (en) * | 2010-12-20 | 2012-05-02 | 中国电子科技集团公司第四十一研究所 | Method and device for converting high-speed linear spectrum data into logarithmic data |
CN102436365B (en) * | 2010-12-20 | 2014-04-09 | 中国电子科技集团公司第四十一研究所 | Method and device for transforming high-speed linear spectrum data to logarithm data |
CN103455302A (en) * | 2012-05-31 | 2013-12-18 | 上海华虹集成电路有限责任公司 | Circuit for realizing logarithm operation by using hardware |
Also Published As
Publication number | Publication date |
---|---|
CN100340940C (en) | 2007-10-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI783295B (en) | Multiplier and multiplication method | |
CN1503938A (en) | Multiplication logic circuit | |
CN1215862A (en) | Computing method and computing device | |
CN1431594A (en) | Method for parallel computing code of CRC in multiple channels and multiple bits | |
CN112434801B (en) | A Convolution Operation Acceleration Method for Weight Splitting According to Bit Accuracy | |
CN1949184A (en) | Method and system of chip checking | |
CN109144473A (en) | A kind of decimal system 3:2 compressor configuration based on redundancy ODDS number | |
CN1677308A (en) | Logarithmic Transformation Method and Device | |
Yan et al. | A novel scheme for real-time max/min-set-selection sorters on FPGA | |
US6298368B1 (en) | Method and apparatus for efficient calculation of an approximate square of a fixed-precision number | |
CN102253822A (en) | A Modular (2n-3) Multiplier | |
CN1265281C (en) | Logarithm operation method and device for floating point numbers | |
CN1261860C (en) | Exponential calculation method and device for floating point numbers | |
CN113378109A (en) | Mixed base fast Fourier transform calculation circuit based on memory calculation | |
Mohan et al. | Evaluation of Mixed-Radix Digit Computation Techniques for the Three Moduli RNS {2 n− 1, 2 n, 2 n+ 1− 1} | |
CN1164988C (en) | 32-bit adder circuit structure | |
CN1862520A (en) | Data processing device and set-up method thereof | |
CN1290002C (en) | High speed adder | |
CN1122024A (en) | Multiplying operation method for optional word length and accuracy and multiplier thereby | |
CN1567175A (en) | Method for simplifying concurrent continuous adding operation of binary number and circuit of continuous adder | |
CN1641564A (en) | Method for operating general multi-level-system coding adder | |
CN1545652A (en) | multiplier circuit | |
CN1133948C (en) | Bindary data counter, area information extractor and Huffman converter | |
CN1629798A (en) | two's complement circuit | |
CN1096035C (en) | Systems, methods and program products for representing binary word as two binary words having fewer binary ones |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
C19 | Lapse of patent right due to non-payment of the annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |