Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newton had a fun way to approximate general roots...
#6
Pete
for high precision sqr approximation using the Newton-Raphson method you can start with low precision and double the precision on each iteration
some pseudo code
Code: (Select All)
l=log(NUM_DIGITS*0.0625)*1.5 'appromimation to l=log(NUM_DIGITS/16)/log(2) ''+ a little extra
'get the first approximation using double arithmetic
'then
    limit&&=16
    for k=1 to l+1
        limit&&=2*limit&&
        tmp = sm_div(n, r, limit&&)
        r2 = sm_add(r, tmp, limit&&)
        r = sm_mul(r2, half, limit&&)
    next
    return r
you can apply the logic for n-root approximation
the first approximation will be more complicated if you want to go beyond the exponential range of double, you could try _Float for the first approximation but unless you use the CRT library it won't work because there's very limited function support for _Float
Reply


Messages In This Thread
RE: Newton had a fun way to approximate general roots... - by Jack - 09-13-2022, 12:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  "I'm Having Fun." James D Jarvis 6 1,309 07-25-2023, 11:32 PM
Last Post: Kernelpanic
  New General Discussion Subforums admin 13 4,723 02-14-2023, 08:21 AM
Last Post: PhilOfPerth
  Fun with hardware acceleration. Pete 0 478 10-20-2022, 10:25 PM
Last Post: Pete
  Roots and powers playing nicely together... Pete 28 5,110 10-01-2022, 10:16 PM
Last Post: Kernelpanic
  Pascal's Triangle and nth roots. Pete 2 883 09-26-2022, 04:15 PM
Last Post: Pete

Forum Jump:


Users browsing this thread: 1 Guest(s)