Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #132054

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

From mhx@iae.nl (mhx)
Newsgroups comp.lang.forth
Subject Re: Complex square root of -1 : zsqrt(-1)
Date 2024-08-28 17:39 +0000
Organization novaBBS
Message-ID <f55b068b628dc4c5ae64a7d71d87c964@www.novabbs.com> (permalink)
References (1 earlier) <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>

Show all headers | View raw


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

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Complex square root of -1 : zsqrt(-1) melahi_ahmed@yahoo.fr (ahmed) - 2024-08-25 08:34 +0000
  Re: Complex square root of -1 : zsqrt(-1) Ron AARON <clf@8th-dev.com> - 2024-08-25 18:38 +0300
  Re: Complex square root of -1 : zsqrt(-1) minforth@gmx.net (minforth) - 2024-08-25 16:50 +0000
  Re: Complex square root of -1 : zsqrt(-1) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2024-08-25 17:13 +0000
    Re: Complex square root of -1 : zsqrt(-1) melahi_ahmed@yahoo.fr (ahmed) - 2024-08-25 17:38 +0000
      Re: Complex square root of -1 : zsqrt(-1) Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-08-25 16:04 -0500
      Re: Complex square root of -1 : zsqrt(-1) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2024-08-28 08:36 +0000
        Re: Complex square root of -1 : zsqrt(-1) melahi_ahmed@yahoo.fr (ahmed) - 2024-08-28 11:33 +0000
          Re: Complex square root of -1 : zsqrt(-1) melahi_ahmed@yahoo.fr (ahmed) - 2024-08-28 14:49 +0000
            Re: Complex square root of -1 : zsqrt(-1) mhx@iae.nl (mhx) - 2024-08-28 17:39 +0000
              Re: Complex square root of -1 : zsqrt(-1) melahi_ahmed@yahoo.fr (ahmed) - 2024-08-28 19:38 +0000
                Re: Complex square root of -1 : zsqrt(-1) melahi_ahmed@yahoo.fr (ahmed) - 2024-08-28 19:49 +0000
                Re: Complex square root of -1 : zsqrt(-1) mhx@iae.nl (mhx) - 2024-08-28 21:42 +0000
                Re: Complex square root of -1 : zsqrt(-1) melahi_ahmed@yahoo.fr (ahmed) - 2024-08-28 22:10 +0000
                Re: Complex square root of -1 : zsqrt(-1) melahi_ahmed@yahoo.fr (ahmed) - 2024-08-28 22:17 +0000
                Re: Complex square root of -1 : zsqrt(-1) mhx@iae.nl (mhx) - 2024-08-28 23:04 +0000
                Re: Complex square root of -1 : zsqrt(-1) melahi_ahmed@yahoo.fr (ahmed) - 2024-09-06 07:11 +0000
                Re: Complex square root of -1 : zsqrt(-1) minforth@gmx.net (minforth) - 2024-09-06 08:14 +0000
                Re: Complex square root of -1 : zsqrt(-1) minforth@gmx.net (minforth) - 2024-09-06 08:20 +0000
                Re: Complex square root of -1 : zsqrt(-1) melahi_ahmed@yahoo.fr (ahmed) - 2024-08-28 21:45 +0000
  Re: Complex square root of -1 : zsqrt(-1) Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-08-25 14:08 -0500
    Re: Complex square root of -1 : zsqrt(-1) Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-08-25 14:16 -0500

csiph-web