Re: Complex square root of -1 : zsqrt(-1)

Liste des GroupesRevenir à cl forth 
Sujet : Re: Complex square root of -1 : zsqrt(-1)
De : mhx (at) *nospam* iae.nl (mhx)
Groupes : comp.lang.forth
Date : 29. Aug 2024, 00:04:04
Autres entêtes
Organisation : novaBBS
Message-ID : <9e33977efbec1e99ef0a539a0ff82b1d@www.novabbs.com>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Rocksolid Light
On Wed, 28 Aug 2024 22:10:46 +0000, ahmed wrote:

On Wed, 28 Aug 2024 21:42:15 +0000, mhx wrote:
>
How about
[..]
Yes, your definition captures my approach (idea).
It works but for 0e 0e xpythag gives 0e and the fstack is not consumed.
>
>
We must empty the fstack in this case.
the defintion becomes
>
: xpythag ( F: a b -- c ) \ compute sqrt(a^2+b^2) without overflow
FABS FSWAP FABS FSWAP
F2DUP F> IF  FOVER ( F: a b a -- ) F/ FSQR F1+ FSQRT  F*  EXIT  ENDIF
FDUP F0= IF  fdrop fdrop 0e
       ELSE  FTUCK ( F: b a b -- ) F/ FSQR F1+ FSQRT  F*
      ENDIF ;
and for z** we can use this defintion of xpythag for |z|
Thanks! This fixes a dormant bug in my XFLOAT-svdcmp...
But I will use "FDUP F0= IF  FDROP " ( stack holds 0e 0e at this point
).
-marcel

Date Sujet#  Auteur
25 Aug 24 * Complex square root of -1 : zsqrt(-1)22ahmed
25 Aug 24 +- Re: Complex square root of -1 : zsqrt(-1)1Ron AARON
25 Aug 24 +- Re: Complex square root of -1 : zsqrt(-1)1minforth
25 Aug 24 +* Re: Complex square root of -1 : zsqrt(-1)17Anton Ertl
25 Aug 24 i`* Re: Complex square root of -1 : zsqrt(-1)16ahmed
25 Aug 24 i +- Re: Complex square root of -1 : zsqrt(-1)1Krishna Myneni
28 Aug 24 i `* Re: Complex square root of -1 : zsqrt(-1)14Anton Ertl
28 Aug 24 i  `* Re: Complex square root of -1 : zsqrt(-1)13ahmed
28 Aug 24 i   `* Re: Complex square root of -1 : zsqrt(-1)12ahmed
28 Aug 24 i    `* Re: Complex square root of -1 : zsqrt(-1)11mhx
28 Aug 24 i     `* Re: Complex square root of -1 : zsqrt(-1)10ahmed
28 Aug 24 i      `* Re: Complex square root of -1 : zsqrt(-1)9ahmed
28 Aug 24 i       +* Re: Complex square root of -1 : zsqrt(-1)7mhx
28 Aug 24 i       i`* Re: Complex square root of -1 : zsqrt(-1)6ahmed
28 Aug 24 i       i +- Re: Complex square root of -1 : zsqrt(-1)1ahmed
29 Aug 24 i       i `* Re: Complex square root of -1 : zsqrt(-1)4mhx
6 Sep 24 i       i  `* Re: Complex square root of -1 : zsqrt(-1)3ahmed
6 Sep 24 i       i   `* Re: Complex square root of -1 : zsqrt(-1)2minforth
6 Sep 24 i       i    `- Re: Complex square root of -1 : zsqrt(-1)1minforth
28 Aug 24 i       `- Re: Complex square root of -1 : zsqrt(-1)1ahmed
25 Aug 24 `* Re: Complex square root of -1 : zsqrt(-1)2Krishna Myneni
25 Aug 24  `- Re: Complex square root of -1 : zsqrt(-1)1Krishna Myneni

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal