High level FSIN and FCOS
  Home FAQ Contact Sign in
comp.lang.forth only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.forth Profile…
 Up
High level FSIN and FCOS         


Author: The Beez'
Date: Apr 25, 2008 10:48

Hi!

Does anyone have some high level source for FSIN and FCOS words? Of
course, FP words allowed ;-) BTW, FLN, F** or others are appreciated
as well.

Hans Bezemer
7 Comments
Re: High level FSIN and FCOS         


Author: Aleksej Saushev
Date: Apr 26, 2008 00:53

"The Beez'" bigfoot.com> writes:
> Hi!
>
> Does anyone have some high level source for FSIN and FCOS words?

: fsinn ( x -- {sin x}/x )
fsqr 1 >f fswap 1 >f 0 >r begin ( a x^2 t ; k )
1 r+! fover f* r 2* >f f/ r 2* 1+ >f f/ fnegate ( a x^2 t' ; k' )
frot fover fover f+ ( x^2 t' a a' ; k' )
ftuck f= >r f-rot r> until ( a' x^2 t' ; k' )
fdrop fdrop r> drop
;
: fsin fdup fsinn f* ;

: r+! rp@ +! ;
: >f s>d d>f ;
: f-rot frot frot ;

Obviously, it won't work for large arguments, you need another
way to calculate Taylor serie, but you want to take argument modulo pi
anyway.

cos(x) = sin (pi - x)
Show full article (0.93Kb)
no comments
Re: High level FSIN and FCOS         


Author: Albert van der Horst
Date: Apr 26, 2008 01:02

In article <4c1d96fb-b352-4cb1-a731-13f27c6926f0@d45g2000hsc.googlegroups.com>,
The Beez' bigfoot.com> wrote:
>Hi!
>
>Does anyone have some high level source for FSIN and FCOS words? Of
>course, FP words allowed ;-) BTW, FLN, F** or others are appreciated
>as well.

This is excerpted of the transputer sources. It will need some adaptation,
like removing the T in front of some words.
This is not rocket science: a standard Chebychev approximation is used
to arrive at most 2 bits from the exact value. (More on those on my
site below.) The binary representation of floats is IEEE.

The series have 8 terms. This is suboptimal for single precision.
_________________________________
TCREATE- SIN
#8 T,
$4A TC, $BB TC, $52 TC, $3C TC,
$2C TC, $26 TC, $06 TC,...
Show full article (5.84Kb)
no comments
Re: High level FSIN and FCOS         


Author: Bill
Date: Apr 26, 2008 09:56

The Beez' wrote:
> Hi!
>
> Does anyone have some high level source for FSIN and FCOS words? Of
> course, FP words allowed ;-) BTW, FLN, F** or others are appreciated
> as well.
>
> Hans Bezemer
Consider "Computer Approximations" by John F Hart 1968 in the SIAM series.
no comments
Re: High level FSIN and FCOS         


Author: Rod Pemberton
Date: Apr 26, 2008 18:55

"The Beez'" bigfoot.com> wrote in message
news:4c1d96fb-b352-4cb1-a731-13f27c6926f0@d45g2000hsc.googlegroups.com...
> Hi!
>
> Does anyone have some high level source for FSIN and FCOS words? Of
> course, FP words allowed ;-) BTW, FLN, F** or others are appreciated
> as well.
>

No.

_FIRST_ link Yahoo pulled up has source for them (Quartus):
http://www.quartus.net/files/PalmOS/Forth125/Snippets125/

You could try generating tables from algorithms here:
http://www.df.lth.se/~john_e/gems/gem0024.html
http://www.musicdsp.org/showone.php?id=9

Rod Pemberton
no comments
Re: High level FSIN and FCOS         


Author: Ed
Date: Apr 26, 2008 19:51

"Bill" wrote in message news:EPOdnab1x7Qqw47VnZ2dnUVZ_qbinZ2d@comcast.com...
> The Beez' wrote:
>> Hi!
>>
>> Does anyone have some high level source for FSIN and FCOS words? Of
>> course, FP words allowed ;-) BTW, FLN, F** or others are appreciated
>> as well.
>>
>> Hans Bezemer
> Consider "Computer Approximations" by John F Hart 1968 in the SIAM series.

This text is often quoted but unfortunately long out of print. Public
libraries and second-hand copies may be the only alternative.

It's ironic that algorithms and data useful to the public is ultimately
subject to considerations such as whether a publisher feels it
commercially viable to reprint.
no comments
Re: High level FSIN and FCOS         


Author: Mark W. Humphries
Date: Apr 26, 2008 20:00

On Apr 27, 10:52 am, "Ed" invalid.com> wrote:
> "Bill" wrote in messagenews:EPOdnab1x7Qqw47VnZ2dnUVZ_qbinZ2d@comcast.com...
>> The Beez' wrote:
>>> Hi!
>
>>> Does anyone have some high level source for FSIN and FCOS words? Of
>>> course, FP words allowed ;-) BTW, FLN, F** or others are appreciated
>>> as well.
>
>>> Hans Bezemer
>> Consider "Computer Approximations" by John F Hart 1968 in the SIAM series.
>
> This text is often quoted but unfortunately long out of print. Public
> libraries and second-hand copies may be the only alternative.
>
> It's ironic that algorithms and data useful to the public is ultimately
> subject to considerations such as whether a publisher feels it
> commercially viable to reprint.
Show full article (0.90Kb)
no comments
Re: High level FSIN and FCOS         


Author: Albert van der Horst
Date: Apr 27, 2008 04:03

In article news-01.bur.connect.com.au>,
Ed invalid.com> wrote:
>
>"Bill" wrote in message news:EPOdnab1x7Qqw47VnZ2dnUVZ_qbinZ2d@comcast.com...
>> The Beez' wrote:
>>> Hi!
>>>
>>> Does anyone have some high level source for FSIN and FCOS words? Of
>>> course, FP words allowed ;-) BTW, FLN, F** or others are appreciated
>>> as well.
>>>
>>> Hans Bezemer
>> Consider "Computer Approximations" by John F Hart 1968 in the SIAM series.
>
>This text is often quoted but unfortunately long out of print. Public
>libraries and second-hand copies may be the only alternative.
>
>It's ironic that algorithms and data useful to the public is ultimately
>subject to considerations such as whether a publisher feels it
>commercially viable to reprint. ...
Show full article (1.61Kb)
no comments