About factored interpolation
  Home FAQ Contact Sign in
comp.lang.forth only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.forth Profile…
 Up
About factored interpolation         


Author: humptydumpty
Date: Apr 23, 2007 22:09

Marcel Hendrix wrote:
> I have great difficulty understanding why posters cling on
> to the stack solution for interpolation.

hi marcel,

is not only a stack solution for interpolation, is:
1. FACTORED solution to linear interpolation and that imply a better
FLEXIBILITY and REUSABILITY.
2. ROUNDED solution for linear interpolation with increased precision:

running gforth-0.6.2 with the test program, even for coarse
division for [0,1] interval ( 1024):

\ factored & rounded ----------------------------------------
: round ( a b -- a+b|a-b)
OVER 0> IF + ELSE - THEN ;

: >space ( x1 x0 x -- T) OVER - -ROT - 1024 SWAP */ ;
: space> ( T y0 y1 -- y) OVER - ROT * 512 round 1024 / + ;
: interpl ( y0 y1 x1 x0 x -- y) >space -ROT space> ;
Show full article (4.01Kb)
no comments