Liste des Groupes | Revenir à cl forth |
On Wed, 28 Aug 2024 21:42:15 +0000, mhx wrote:[..]
>How about
Yes, your definition captures my approach (idea).Thanks! This fixes a dormant bug in my XFLOAT-svdcmp...
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|
Les messages affichés proviennent d'usenet.