Re: Fast Cube Root Using C33
- From: Jerry Avins <jya@xxxxxxxx>
- Date: Fri, 27 Feb 2009 08:56:15 -0500
Tim Wescott wrote:
On Thu, 26 Feb 2009 19:04:01 -0800, pnachtwey wrote:
I need a fast cube root routine. I started with the obvious
http://metamerist.com/cbrt/cbrt.htm
What is key is getting the initial estimate using the Kahan bit hack but
that only works with IEEE floating point and not with TI floating point.
I can't believe that I am the first to do this since the C33 is
ancient. The obvious solution is to convert the TI float to the IEEE
float, apply the hack, and then convert back to TI float but there must
be a better way. Actually doing another iteration is probably faster. The problem is that sign of the mantissa is at bit 23.
Does anyboy know of a link? Thanks.
Peter Nachtwey
Does anyone here remember how to take the square root of a decimal number via "long division"? My dad taught me how when I was considerably shorter than I am now, possibly because he was appalled at his brother teaching me how to do it on a calculator using Newton's method.
For those of you under 80, it's basically a method for churning out decimals of the square root of a number in a method very akin to long division, except that at each step instead of subtracting (cumulative result) * (guess) you subtract (2 * cumulative result + guess) * (guess) -- you're basically trying to complete the equation (cumulative result + guess) ^ 2 = (cumulative result)^2 + 2 * (cumulative result)(guess) + (guess)^2.
It turns out that -- like long division -- it's really easy to do on a computer in binary because when you're only multiplying by 0 or 1 you don't have to waste a lot of time guessing.
It also turns out that if you're a _real_ math geek you can work out how to do this with cube roots, and, like square roots and division the guesswork is held to a minimum because you're just dealing with ones and zeros.
If the group shows sufficient interest I'll write it up and post it. I figured it out when I was in high school then for got it. Peter's post got me interested enough to figure it out again (thanks Peter!), but I'm not sure if it's faster than Newton's method unless you're doing the work on an FPGA.
Each step starts with you knowing the starting value - answer^3, and needing to calculate 3*answer^2 and 3*answer. You then have to subtract those two numbers from your residual to know if you emit a '1' or a '0'.
I _suspect_ that it's not as quick as Newton's method, but it's late and I'm not (by gawd) going to check!
There is in general a fundamental difference between paper-and-pencil algorithms and those run on a computer with a good divide, and usually, the computer version needs fewer steps.
With paper and pencil, one wants the next digit that is just not too large. With machinery that can divide, one wants the best approximation without regard to the number of digits produced.
Jerry
--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
.
- Follow-Ups:
- Re: Fast Cube Root Using C33
- From: Tim Wescott
- Re: Fast Cube Root Using C33
- From: Glen Herrmannsfeldt
- Re: Fast Cube Root Using C33
- References:
- Fast Cube Root Using C33
- From: pnachtwey
- Re: Fast Cube Root Using C33
- From: Tim Wescott
- Fast Cube Root Using C33
- Prev by Date: Re: integration of a continuous function
- Next by Date: Re: Channel Matrix in Typical MIMO Equations
- Previous by thread: Re: Fast Cube Root Using C33
- Next by thread: Re: Fast Cube Root Using C33
- Index(es):
Relevant Pages
|
Loading