Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #22204

Re: Parallel FIB

From Bernd Paysan <bernd.paysan@gmx.de>
Newsgroups comp.lang.forth
Subject Re: Parallel FIB
Date 2013-05-03 18:13 +0200
Organization 1&1 Internet AG
Message-ID <km0nns$81h$1@online.de> (permalink)
References <2013May2.161355@mips.complang.tuwien.ac.at> <12999600988434@frunobulax.edu> <2013May3.142604@mips.complang.tuwien.ac.at> <km0dpg$o1$1@online.de>

Show all headers | View raw


Bernd Paysan wrote:
> The trouble with Fibonacci as benchmark is that the double-recursiveness
> isn't real.  Fibonacci is a O(1) function,

If you don't beleave, that's it:

5e fsqrt fdup 1/f fconstant /sqrt5
1e f+ f2/ fln     fconstant gbase
: fib ( n -- f )
  dup s>f gbase f* fdup fexp fswap fnegate fexp
  1 and IF f+ ELSE f- THEN  /sqrt5 f* ;

The ( n ) 1 and IF f+ ELSE f- THEN is since it's really (1-g)^n, but fln 
can't handle negative bases.  With complex numbers, you can calculate fib 
for any complex number.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-02 01:20 +0200
  Re: Parallel FIB anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-02 14:13 +0000
    Re: Parallel FIB Paul Rubin <no.email@nospam.invalid> - 2013-05-02 08:25 -0700
    Re: Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-03 07:04 +0200
      Re: Parallel FIB anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-03 12:26 +0000
        Re: Parallel FIB Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-03 15:23 +0200
          Re: Parallel FIB fred <email@address.com> - 2013-05-03 16:56 +0100
          Re: Parallel FIB Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-03 18:13 +0200
        Re: Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-03 21:14 +0200
          Re: Parallel FIB anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-04 13:45 +0000
        Re: Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-03 21:29 +0200
          Re: Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-03 23:53 +0200
            Re: Parallel FIB Paul Rubin <no.email@nospam.invalid> - 2013-05-03 18:10 -0700
              Re: Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-04 07:07 +0200
                Re: Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-06 21:09 +0200
        Re: Parallel FIB albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-05-04 00:26 +0000

csiph-web