Deutsch   English   Français   Italiano  
<f55b068b628dc4c5ae64a7d71d87c964@www.novabbs.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder9.news.weretis.net!news.nk.ca!rocksolid2!i2pn2.org!.POSTED!not-for-mail
From: mhx@iae.nl (mhx)
Newsgroups: comp.lang.forth
Subject: Re: Complex square root of -1 : zsqrt(-1)
Date: Wed, 28 Aug 2024 17:39:18 +0000
Organization: novaBBS
Message-ID: <f55b068b628dc4c5ae64a7d71d87c964@www.novabbs.com>
References: <cc2a1ec5eae8d18d290b398af3c013cb@www.novabbs.com> <2024Aug25.191346@mips.complang.tuwien.ac.at> <c02b8db68bf735b5c30c7d5979b942a3@www.novabbs.com> <2024Aug28.103612@mips.complang.tuwien.ac.at> <20540ab199e43e94b3d156a1dd58e3f2@www.novabbs.com> <d9184f7688ceced53b41535c172032b3@www.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
	logging-data="50039"; mail-complaints-to="usenet@i2pn2.org";
	posting-account="t0bSWFIQDvYvkkhDiPIIv6byulC6WbSEwXWMJpxc4k0";
User-Agent: Rocksolid Light
X-Spam-Checker-Version: SpamAssassin 4.0.0
X-Rslight-Site: $2y$10$APTDs2FvW/ZV72WNnE.jvu3WVgd.Cnxr8z2kUCcTqU4ehDM4WSo0C
X-Rslight-Posting-User: 59549e76d0c3560fb37b97f0b9407a8c14054f24
Bytes: 2233
Lines: 34

On Wed, 28 Aug 2024 14:49:01 +0000, ahmed wrote:

> I think this version gives the same results as Matlab
>
>
> : 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

And what does Matlab/gForth give for this?

1e-309 0e   -1e 1e  z** z. (  7.188026e+0307 -9.974133e+0308 ) ok

-marcel