Liste des Groupes | Revenir à cl forth |
I think this version gives the same results as MatlabAnd what does Matlab/gForth give for this?
>
>
: z** ( z: a+ib c+id -- e+if)
zdup z0= if zdrop zdrop 1e 0e exit then
fover f0> if zover z0= if zdrop zdrop 0e 0e exit then then
zdup f0= f0< and if zover z0= if zdrop zdrop Inf 0e exit then then
zswap zln z* zexp
;
>
some tests:
>
0e 0e 0e 0e z** z. 1. ok
0e 0e 1e 0e z** z. 0 ok
0e 0e -1e 0e z** z. inf ok
1e 1e 0e 0e z** z. 1. ok
1e 1e 0e 1e z** z. 0.428829006294368 +0.154871752464247 i ok
0e 0e 0e 1e z** z. NaN+NaNi ok
0e 0e 1e 1e z** z. 0 ok
0e 0e -1e 1e z** z. NaN+NaNi ok
-1e 0e 0.5e 0e z** z. 0.0000000000000000612303176911189 +1. i ok
-1e 0e 0e 0e z** z. 1. ok
-1e 1e 0e 0e z** z. 1. ok
-1e 1e 1e 0e z** z. -1. +1. i ok
-1e 1e 1e 1e z** z. -0.121339466446359 +0.0569501178644237 i ok
>
Ahmed
Les messages affichés proviennent d'usenet.