| Deutsch English Français Italiano |
|
<f892e753c0d657d592749d9d80632328@www.novabbs.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.misty.com!weretis.net!feeder9.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail
From: melahi_ahmed@yahoo.fr (ahmed)
Newsgroups: comp.lang.forth
Subject: Re: Differentiable Forth
Date: Fri, 26 Jul 2024 12:27:06 +0000
Organization: novaBBS
Message-ID: <f892e753c0d657d592749d9d80632328@www.novabbs.com>
References: <e9689378e46f06961fe4fe43b47dfd3b@www.novabbs.com> <v766m4$3hipk$1@news.xmission.com> <f806c73034c83af94d0ce3d857075241@www.novabbs.com> <7e6998ad43698a3e80e2483e932ec7a1@www.novabbs.com> <06155327b9b2e4b08c479044803e2511@www.novabbs.com> <a6052445cfd6c3264ff86446dbbe2d37@www.novabbs.com> <a8ec944a53a7b48d3994102035e987ab@www.novabbs.com> <cf3e51477813a438fe9f5f632a0ce90f@www.novabbs.com> <8f86fe925de98123b5ec47a1c49c67ca@www.novabbs.com> <b0ea2fba69e0b5936aeca68fd0cb924f@www.novabbs.com> <5b7efcf31e80b12d0ed94f1850dcfaac@www.novabbs.com> <58331abb76ea2918cf38ee81d5538aa5@www.novabbs.com> <ec3b8c009fa818819500d407f1a8373b@www.novabbs.com> <7d1a305ae4ef4838f84874b6de465d67@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="422170"; mail-complaints-to="usenet@i2pn2.org";
posting-account="fh2jRJ/PGtIlZMySaIjc6gsLWP80WZpB2lZYFC5wgKI";
User-Agent: Rocksolid Light
X-Rslight-Posting-User: a55529988cdb6fa7b5e36631aef8884238b8448a
X-Spam-Checker-Version: SpamAssassin 4.0.0
X-Rslight-Site: $2y$10$BoM21kn66aGqyCuZcb26HOaw9d7WMboC9hCOBT0UMvvudqnBC9y2e
Bytes: 2611
Lines: 37
There is another problem with dl^.
The definition of dl^ given previously has problems:
a b dl^ doesn't work when:
- a is a dual number with negative real part ( for example: a =
-5.6 + eps c, c in R)
and (in the same time)
- b is a dual number with real part is integer and even ( for
example: b = 8 + eps d, d in R)
For floats, we have -5.6e 8e f** f. 967173.11574016 ok
But with dl^, we get : -5.6e f>dl 8e f>dl dl^ dl. NaN+ eps NaN ok
Here is the new definition of dl^, it corrects this problem.
: is_even_integer? ( f: a --) ( -- f)
fdup f>s dup s>f f=
swap 2 mod 0= and
;
: dl^ ( dl: a b -- a^b) \ a^b = exp(b*ln(a))
dldup dl>rl f0= if dldrop dldrop 1e 0e exit then
dldup dl>rl is_even_integer? if
dlswap
fswap fabs fswap
dlln dl* dlexp exit
then
dlover dl>rl f0<> if dlswap dlln dl* dlexp exit then
dldrop dldrop 0e 0e
;
For the same example, it gives
-5.6e f>dl 8e f>dl dl^ dl. 967173.11574016 + eps 0.
which is ok.
Ahmed