Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Today is a good day for information-gathering. Read someone else's mail file.


devel / comp.lang.forth / Re: What do floating point words do with NAN?

SubjectAuthor
* What do floating point words do with NAN?Rick C
+- Re: What do floating point words do with NAN?dxforth
+- Re: What do floating point words do with NAN?Anton Ertl
`* Re: What do floating point words do with NAN?minf...@arcor.de
 +- Re: What do floating point words do with NAN?Rick C
 `* Re: What do floating point words do with NAN?Krishna Myneni
  `* Re: What do floating point words do with NAN?minf...@arcor.de
   +* Re: What do floating point words do with NAN?Krishna Myneni
   |`* Re: What do floating point words do with NAN?minf...@arcor.de
   | +* Re: What do floating point words do with NAN?Krishna Myneni
   | |+* Re: What do floating point words do with NAN?minf...@arcor.de
   | ||+* Re: What do floating point words do with NAN?Krishna Myneni
   | |||`- Re: What do floating point words do with NAN?minf...@arcor.de
   | ||`* Re: What do floating point words do with NAN?none
   | || +* Re: What do floating point words do with NAN?minf...@arcor.de
   | || |`* Re: What do floating point words do with NAN?Anton Ertl
   | || | `* Re: What do floating point words do with NAN?Marcel Hendrix
   | || |  `- Re: What do floating point words do with NAN?Anton Ertl
   | || +- Re: What do floating point words do with NAN?dxforth
   | || `- Re: What do floating point words do with NAN?Anton Ertl
   | |+- Re: What do floating point words do with NAN?dxforth
   | |`* Re: What do floating point words do with NAN?Anton Ertl
   | | `* Re: What do floating point words do with NAN?dxforth
   | |  +* Re: What do floating point words do with NAN?Paul Rubin
   | |  |+- Re: What do floating point words do with NAN?dxforth
   | |  |`* Re: What do floating point words do with NAN?Anton Ertl
   | |  | `* Re: What do floating point words do with NAN?Paul Rubin
   | |  |  +- Re: What do floating point words do with NAN?dxforth
   | |  |  `- Re: What do floating point words do with NAN?Anton Ertl
   | |  `* Re: What do floating point words do with NAN?Anton Ertl
   | |   `* Re: What do floating point words do with NAN?dxforth
   | |    +- Re: What do floating point words do with NAN?Marcel Hendrix
   | |    +- Re: What do floating point words do with NAN?Marcel Hendrix
   | |    +* Re: What do floating point words do with NAN?Marcel Hendrix
   | |    |+* Re: What do floating point words do with NAN?dxforth
   | |    ||`- Re: What do floating point words do with NAN?Marcel Hendrix
   | |    |`* Re: What do floating point words do with NAN?none
   | |    | `- Re: What do floating point words do with NAN?dxforth
   | |    +* Re: What do floating point words do with NAN?Paul Rubin
   | |    |`- Re: What do floating point words do with NAN?dxforth
   | |    `* Re: What do floating point words do with NAN?Anton Ertl
   | |     +* Re: What do floating point words do with NAN?dxforth
   | |     |`- Re: What do floating point words do with NAN?Anton Ertl
   | |     +* Re: What do floating point words do with NAN?minf...@arcor.de
   | |     |+* Re: What do floating point words do with NAN?Marcel Hendrix
   | |     ||+* Re: What do floating point words do with NAN?minf...@arcor.de
   | |     |||`- Re: What do floating point words do with NAN?Marcel Hendrix
   | |     ||`* Re: What do floating point words do with NAN?dxforth
   | |     || +* Re: What do floating point words do with NAN?Marcel Hendrix
   | |     || |`- Re: What do floating point words do with NAN?dxforth
   | |     || `* Re: What do floating point words do with NAN?Anton Ertl
   | |     ||  +- Re: What do floating point words do with NAN?dxforth
   | |     ||  `* Re: What do floating point words do with NAN?dxforth
   | |     ||   `* Re: What do floating point words do with NAN?minf...@arcor.de
   | |     ||    `* Re: What do floating point words do with NAN?Krishna Myneni
   | |     ||     +* Re: What do floating point words do with NAN?minf...@arcor.de
   | |     ||     |`- Re: What do floating point words do with NAN?Krishna Myneni
   | |     ||     `* Re: What do floating point words do with NAN?Krishna Myneni
   | |     ||      +* Re: What do floating point words do with NAN?dxforth
   | |     ||      |`- Re: What do floating point words do with NAN?Krishna Myneni
   | |     ||      `* Re: What do floating point words do with NAN?Krishna Myneni
   | |     ||       `- Re: What do floating point words do with NAN?Krishna Myneni
   | |     |`- Re: What do floating point words do with NAN?dxforth
   | |     `- Re: What do floating point words do with NAN?Paul Rubin
   | `- Re: What do floating point words do with NAN?Anton Ertl
   +- Re: What do floating point words do with NAN?dxforth
   `- Re: What do floating point words do with NAN?Anton Ertl

Pages:123
Re: What do floating point words do with NAN?

<6adfaad9-6aa7-464c-9576-f1cb9aed13d0n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19249&group=comp.lang.forth#19249

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ad4:4ead:0:b0:474:48e:cd20 with SMTP id ed13-20020ad44ead000000b00474048ecd20mr7451896qvb.81.1658414243832;
Thu, 21 Jul 2022 07:37:23 -0700 (PDT)
X-Received: by 2002:a37:503:0:b0:6b5:e2ea:6932 with SMTP id
3-20020a370503000000b006b5e2ea6932mr15633372qkf.25.1658414243666; Thu, 21 Jul
2022 07:37:23 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 21 Jul 2022 07:37:23 -0700 (PDT)
In-Reply-To: <1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=185.124.144.166; posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 185.124.144.166
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<2d539c96-8864-45ef-943e-6ac058acd6f3n@googlegroups.com> <tap0g8$2n35d$1@dont-email.me>
<3675fe47-7109-431c-a953-6e7b922d8817n@googlegroups.com> <tap7jo$2ns97$1@dont-email.me>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com> <tapfik$2onhk$1@dont-email.me>
<2022Jul18.174825@mips.complang.tuwien.ac.at> <tb5370$rrp$1@gioia.aioe.org>
<2022Jul19.101846@mips.complang.tuwien.ac.at> <tb5v5f$hjn$1@gioia.aioe.org>
<2022Jul20.134852@mips.complang.tuwien.ac.at> <4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6adfaad9-6aa7-464c-9576-f1cb9aed13d0n@googlegroups.com>
Subject: Re: What do floating point words do with NAN?
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Thu, 21 Jul 2022 14:37:23 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2628
 by: minf...@arcor.de - Thu, 21 Jul 2022 14:37 UTC

Marcel Hendrix schrieb am Mittwoch, 20. Juli 2022 um 21:11:31 UTC+2:
> On Wednesday, July 20, 2022 at 6:21:04 PM UTC+2, minf...@arcor.de wrote:
> > Anton Ertl schrieb am Mittwoch, 20. Juli 2022 um 13:53:06 UTC+2:
> [..]
> > How can this be qustioned??
> > Branch cuts are an important thing eg in the field of trigonometric and
> > logarithmic functions, particularly in the complex plane.
> > +0e FDUP FLN f. f. -inf +0.
> > -0e FDUP FLN f. -nan -0.
> > The only thing that is undefined is the 'sign' of nan. The signs before 0.
> > are important.
> You had me worried for a moment but it isn't as simple as that :--)
>
> MATLAB:
> >> log(-0)
> ans = -Inf
> >> log(+0)
> ans = -Inf

Everyone is free and happy to cook her own soup ;-)

Wolfram Alpha does:
log(0.0) or log(-0.0) --> undefined, whereas
log(0+0i) -> -inf, whereas
log(0.0+0.0i) -> undefined

Re: What do floating point words do with NAN?

<5d3f94a2-fc99-483f-baa5-afd3703cd93fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19252&group=comp.lang.forth#19252

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:7d96:0:b0:31e:f953:ae40 with SMTP id c22-20020ac87d96000000b0031ef953ae40mr13260100qtd.511.1658424306651;
Thu, 21 Jul 2022 10:25:06 -0700 (PDT)
X-Received: by 2002:ac8:7dcf:0:b0:31f:9fc:fa93 with SMTP id
c15-20020ac87dcf000000b0031f09fcfa93mr6871663qte.185.1658424306494; Thu, 21
Jul 2022 10:25:06 -0700 (PDT)
Path: i2pn2.org!rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border-1.nntp.ord.giganews.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 21 Jul 2022 10:25:06 -0700 (PDT)
In-Reply-To: <6adfaad9-6aa7-464c-9576-f1cb9aed13d0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:5154:d093:90ae:d62a;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:5154:d093:90ae:d62a
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<2d539c96-8864-45ef-943e-6ac058acd6f3n@googlegroups.com> <tap0g8$2n35d$1@dont-email.me>
<3675fe47-7109-431c-a953-6e7b922d8817n@googlegroups.com> <tap7jo$2ns97$1@dont-email.me>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com> <tapfik$2onhk$1@dont-email.me>
<2022Jul18.174825@mips.complang.tuwien.ac.at> <tb5370$rrp$1@gioia.aioe.org>
<2022Jul19.101846@mips.complang.tuwien.ac.at> <tb5v5f$hjn$1@gioia.aioe.org>
<2022Jul20.134852@mips.complang.tuwien.ac.at> <4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com> <6adfaad9-6aa7-464c-9576-f1cb9aed13d0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5d3f94a2-fc99-483f-baa5-afd3703cd93fn@googlegroups.com>
Subject: Re: What do floating point words do with NAN?
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Thu, 21 Jul 2022 17:25:06 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 17
 by: Marcel Hendrix - Thu, 21 Jul 2022 17:25 UTC

On Thursday, July 21, 2022 at 4:37:24 PM UTC+2, minf...@arcor.de wrote:
> Marcel Hendrix schrieb am Mittwoch, 20. Juli 2022 um 21:11:31 UTC+2:
[..]
> > MATLAB:
> > >> log(-0)
> > ans = -Inf
> > >> log(+0)
> > ans = -Inf
> Everyone is free and happy to cook her own soup ;-)
>
> Wolfram Alpha does:
> log(0.0) or log(-0.0) --> undefined, whereas
> log(0+0i) -> -inf, whereas
> log(0.0+0.0i) -> undefined

Soup? More like a bitches' brew.

-marcel

Re: What do floating point words do with NAN?

<tbd2ia$1lqs$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19257&group=comp.lang.forth#19257

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: What do floating point words do with NAN?
Date: Fri, 22 Jul 2022 12:38:02 +1000
Organization: Aioe.org NNTP Server
Message-ID: <tbd2ia$1lqs$1@gioia.aioe.org>
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<2d539c96-8864-45ef-943e-6ac058acd6f3n@googlegroups.com>
<tap0g8$2n35d$1@dont-email.me>
<3675fe47-7109-431c-a953-6e7b922d8817n@googlegroups.com>
<tap7jo$2ns97$1@dont-email.me>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com>
<tapfik$2onhk$1@dont-email.me> <2022Jul18.174825@mips.complang.tuwien.ac.at>
<tb5370$rrp$1@gioia.aioe.org> <2022Jul19.101846@mips.complang.tuwien.ac.at>
<tb5v5f$hjn$1@gioia.aioe.org> <2022Jul20.134852@mips.complang.tuwien.ac.at>
<4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="55132"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Fri, 22 Jul 2022 02:38 UTC

On 21/07/2022 05:11, Marcel Hendrix wrote:
> On Wednesday, July 20, 2022 at 6:21:04 PM UTC+2, minf...@arcor.de wrote:
>> Anton Ertl schrieb am Mittwoch, 20. Juli 2022 um 13:53:06 UTC+2:
> [..]
>> How can this be qustioned??
>> Branch cuts are an important thing eg in the field of trigonometric and
>> logarithmic functions, particularly in the complex plane.
>> +0e FDUP FLN f. f. -inf +0.
>> -0e FDUP FLN f. -nan -0.
>> The only thing that is undefined is the 'sign' of nan. The signs before 0.
>> are important.
>
> You had me worried for a moment but it isn't as simple as that :--)
>
> MATLAB:
>>> log(-0)
> ans = -Inf
>>> log(+0)
> ans = -Inf

VFX:
0e fln f. -NaN ok

DX-Forth:
0e fln f. -INF ok

As both use the same x87 instructions I'm guessing it's something
to do with NAN/INF decoding.

Re: What do floating point words do with NAN?

<74ad3ed0-0792-4a74-8225-26c1aa1edeb1n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19259&group=comp.lang.forth#19259

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:2996:b0:6b5:e434:66b3 with SMTP id r22-20020a05620a299600b006b5e43466b3mr1333255qkp.616.1658466341253;
Thu, 21 Jul 2022 22:05:41 -0700 (PDT)
X-Received: by 2002:a05:622a:386:b0:31e:ffe5:bcf8 with SMTP id
j6-20020a05622a038600b0031effe5bcf8mr1655329qtx.404.1658466341126; Thu, 21
Jul 2022 22:05:41 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 21 Jul 2022 22:05:40 -0700 (PDT)
In-Reply-To: <tbd2ia$1lqs$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:5154:d093:90ae:d62a;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:5154:d093:90ae:d62a
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<2d539c96-8864-45ef-943e-6ac058acd6f3n@googlegroups.com> <tap0g8$2n35d$1@dont-email.me>
<3675fe47-7109-431c-a953-6e7b922d8817n@googlegroups.com> <tap7jo$2ns97$1@dont-email.me>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com> <tapfik$2onhk$1@dont-email.me>
<2022Jul18.174825@mips.complang.tuwien.ac.at> <tb5370$rrp$1@gioia.aioe.org>
<2022Jul19.101846@mips.complang.tuwien.ac.at> <tb5v5f$hjn$1@gioia.aioe.org>
<2022Jul20.134852@mips.complang.tuwien.ac.at> <4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com> <tbd2ia$1lqs$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <74ad3ed0-0792-4a74-8225-26c1aa1edeb1n@googlegroups.com>
Subject: Re: What do floating point words do with NAN?
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Fri, 22 Jul 2022 05:05:41 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2964
 by: Marcel Hendrix - Fri, 22 Jul 2022 05:05 UTC

On Friday, July 22, 2022 at 4:38:04 AM UTC+2, dxforth wrote:
> On 21/07/2022 05:11, Marcel Hendrix wrote:
> > On Wednesday, July 20, 2022 at 6:21:04 PM UTC+2, minf...@arcor.de wrote:
> >> Anton Ertl schrieb am Mittwoch, 20. Juli 2022 um 13:53:06 UTC+2:
> > [..]
> >> How can this be qustioned??
> >> Branch cuts are an important thing eg in the field of trigonometric and
> >> logarithmic functions, particularly in the complex plane.
> >> +0e FDUP FLN f. f. -inf +0.
> >> -0e FDUP FLN f. -nan -0.
> >> The only thing that is undefined is the 'sign' of nan. The signs before 0.
> >> are important.
> >
> > You had me worried for a moment but it isn't as simple as that :--)
> >
> > MATLAB:
> >>> log(-0)
> > ans = -Inf
> >>> log(+0)
> > ans = -Inf
> VFX:
> 0e fln f. -NaN ok
>
> DX-Forth:
> 0e fln f. -INF ok
>
> As both use the same x87 instructions I'm guessing it's something
> to do with NAN/INF decoding.

Why Inf? What about this classic:

FORTH> +0e fdup fsin fswap f/ f. -NAN ok
FORTH> +0e fdup fcos fswap f/ f. +INF ok
FORTH> -0e fdup fcos fswap f/ f. -INF ok
FORTH> 0e fdup fcos fswap f/ f. +INF ok

-marcel

Re: What do floating point words do with NAN?

<2022Jul22.071641@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19261&group=comp.lang.forth#19261

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: What do floating point words do with NAN?
Date: Fri, 22 Jul 2022 05:16:41 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 22
Message-ID: <2022Jul22.071641@mips.complang.tuwien.ac.at>
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com> <5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com> <tapfik$2onhk$1@dont-email.me> <2022Jul18.174825@mips.complang.tuwien.ac.at> <tb5370$rrp$1@gioia.aioe.org> <2022Jul19.101846@mips.complang.tuwien.ac.at> <tb5v5f$hjn$1@gioia.aioe.org> <2022Jul20.134852@mips.complang.tuwien.ac.at> <4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com> <1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com> <tbd2ia$1lqs$1@gioia.aioe.org>
Injection-Info: reader01.eternal-september.org; posting-host="1831f4dd646ea202e489fdc16dc5d20a";
logging-data="3058166"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Z5l+Bz/q2olNVgQREsGfS"
Cancel-Lock: sha1:fCIJ8RVBtw1UwT/X//jkf+GkUN4=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Fri, 22 Jul 2022 05:16 UTC

dxforth <dxforth@gmail.com> writes:
>VFX:
>0e fln f. -NaN ok

VFX Forth for Linux IA32 Version: 4.72 [build 0555]
Including /usr/local/VfxLinEval/Lib/x86/Ndp387.fth
0e fln f. -Inf ok
NDP Potential Exception: NDP SW = 0004

VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
© MicroProcessor Engineering Ltd, 1998-2021

0e fln f. Invalid argument to FLN/FLOG
-> 0e fln f.
^

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2022: http://www.euroforth.org/ef22/cfp.html

Re: What do floating point words do with NAN?

<tbdgm1$1qeh$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19263&group=comp.lang.forth#19263

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: What do floating point words do with NAN?
Date: Fri, 22 Jul 2022 16:38:57 +1000
Organization: Aioe.org NNTP Server
Message-ID: <tbdgm1$1qeh$1@gioia.aioe.org>
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com>
<tapfik$2onhk$1@dont-email.me> <2022Jul18.174825@mips.complang.tuwien.ac.at>
<tb5370$rrp$1@gioia.aioe.org> <2022Jul19.101846@mips.complang.tuwien.ac.at>
<tb5v5f$hjn$1@gioia.aioe.org> <2022Jul20.134852@mips.complang.tuwien.ac.at>
<4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com>
<tbd2ia$1lqs$1@gioia.aioe.org> <2022Jul22.071641@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="59857"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Fri, 22 Jul 2022 06:38 UTC

On 22/07/2022 15:16, Anton Ertl wrote:
> dxforth <dxforth@gmail.com> writes:
>>VFX:
>>0e fln f. -NaN ok
>
> VFX Forth for Linux IA32 Version: 4.72 [build 0555]
> Including /usr/local/VfxLinEval/Lib/x86/Ndp387.fth
> 0e fln f. -Inf ok
> NDP Potential Exception: NDP SW = 0004
>
> VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
> © MicroProcessor Engineering Ltd, 1998-2021
>
> 0e fln f. Invalid argument to FLN/FLOG
> -> 0e fln f.
> ^

Looks likes 32->64 conversion issues (for Win x64 anyway).
I've sent Stephen an email and mentioned your result.

Re: What do floating point words do with NAN?

<tbdkr0$1kvg$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19265&group=comp.lang.forth#19265

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: What do floating point words do with NAN?
Date: Fri, 22 Jul 2022 17:49:51 +1000
Organization: Aioe.org NNTP Server
Message-ID: <tbdkr0$1kvg$1@gioia.aioe.org>
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<2d539c96-8864-45ef-943e-6ac058acd6f3n@googlegroups.com>
<tap0g8$2n35d$1@dont-email.me>
<3675fe47-7109-431c-a953-6e7b922d8817n@googlegroups.com>
<tap7jo$2ns97$1@dont-email.me>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com>
<tapfik$2onhk$1@dont-email.me> <2022Jul18.174825@mips.complang.tuwien.ac.at>
<tb5370$rrp$1@gioia.aioe.org> <2022Jul19.101846@mips.complang.tuwien.ac.at>
<tb5v5f$hjn$1@gioia.aioe.org> <2022Jul20.134852@mips.complang.tuwien.ac.at>
<4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com>
<tbd2ia$1lqs$1@gioia.aioe.org>
<74ad3ed0-0792-4a74-8225-26c1aa1edeb1n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="54256"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Fri, 22 Jul 2022 07:49 UTC

On 22/07/2022 15:05, Marcel Hendrix wrote:
> On Friday, July 22, 2022 at 4:38:04 AM UTC+2, dxforth wrote:
>> On 21/07/2022 05:11, Marcel Hendrix wrote:
>> > On Wednesday, July 20, 2022 at 6:21:04 PM UTC+2, minf...@arcor.de wrote:
>> >> Anton Ertl schrieb am Mittwoch, 20. Juli 2022 um 13:53:06 UTC+2:
>> > [..]
>> >> How can this be qustioned??
>> >> Branch cuts are an important thing eg in the field of trigonometric and
>> >> logarithmic functions, particularly in the complex plane.
>> >> +0e FDUP FLN f. f. -inf +0.
>> >> -0e FDUP FLN f. -nan -0.
>> >> The only thing that is undefined is the 'sign' of nan. The signs before 0.
>> >> are important.
>> >
>> > You had me worried for a moment but it isn't as simple as that :--)
>> >
>> > MATLAB:
>> >>> log(-0)
>> > ans = -Inf
>> >>> log(+0)
>> > ans = -Inf
>> VFX:
>> 0e fln f. -NaN ok
>>
>> DX-Forth:
>> 0e fln f. -INF ok
>>
>> As both use the same x87 instructions I'm guessing it's something
>> to do with NAN/INF decoding.
>
> Why Inf? What about this classic:
>
> FORTH> +0e fdup fsin fswap f/ f. -NAN ok
> FORTH> +0e fdup fcos fswap f/ f. +INF ok
> FORTH> -0e fdup fcos fswap f/ f. -INF ok
> FORTH> 0e fdup fcos fswap f/ f. +INF ok

After applying a fix to VFX64 I get those, in addition to 0e FLN working
as expected. Why is it classic?

Re: What do floating point words do with NAN?

<tbihul$1ka2$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19305&group=comp.lang.forth#19305

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: What do floating point words do with NAN?
Date: Sun, 24 Jul 2022 14:31:16 +1000
Organization: Aioe.org NNTP Server
Message-ID: <tbihul$1ka2$1@gioia.aioe.org>
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com>
<tapfik$2onhk$1@dont-email.me> <2022Jul18.174825@mips.complang.tuwien.ac.at>
<tb5370$rrp$1@gioia.aioe.org> <2022Jul19.101846@mips.complang.tuwien.ac.at>
<tb5v5f$hjn$1@gioia.aioe.org> <2022Jul20.134852@mips.complang.tuwien.ac.at>
<4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com>
<tbd2ia$1lqs$1@gioia.aioe.org> <2022Jul22.071641@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="53570"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Sun, 24 Jul 2022 04:31 UTC

On 22/07/2022 15:16, Anton Ertl wrote:
> dxforth <dxforth@gmail.com> writes:
>>VFX:
>>0e fln f. -NaN ok
>
> VFX Forth for Linux IA32 Version: 4.72 [build 0555]
> Including /usr/local/VfxLinEval/Lib/x86/Ndp387.fth
> 0e fln f. -Inf ok
> NDP Potential Exception: NDP SW = 0004
>
> VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
> © MicroProcessor Engineering Ltd, 1998-2021
>
> 0e fln f. Invalid argument to FLN/FLOG
> -> 0e fln f.
> ^

Stephen advises the fix will be in the next release.

Re: What do floating point words do with NAN?

<3714874a-4d75-4654-94bd-d3310706e3c4n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19459&group=comp.lang.forth#19459

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:d02:b0:474:81cc:599e with SMTP id 2-20020a0562140d0200b0047481cc599emr6947510qvh.29.1659183772015;
Sat, 30 Jul 2022 05:22:52 -0700 (PDT)
X-Received: by 2002:a05:622a:1b9f:b0:31f:515:5594 with SMTP id
bp31-20020a05622a1b9f00b0031f05155594mr6949803qtb.117.1659183771859; Sat, 30
Jul 2022 05:22:51 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 30 Jul 2022 05:22:51 -0700 (PDT)
In-Reply-To: <tbihul$1ka2$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f27:a8a3:c858:ada1:2ab2:354a;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f27:a8a3:c858:ada1:2ab2:354a
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com> <tapfik$2onhk$1@dont-email.me>
<2022Jul18.174825@mips.complang.tuwien.ac.at> <tb5370$rrp$1@gioia.aioe.org>
<2022Jul19.101846@mips.complang.tuwien.ac.at> <tb5v5f$hjn$1@gioia.aioe.org>
<2022Jul20.134852@mips.complang.tuwien.ac.at> <4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com> <tbd2ia$1lqs$1@gioia.aioe.org>
<2022Jul22.071641@mips.complang.tuwien.ac.at> <tbihul$1ka2$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3714874a-4d75-4654-94bd-d3310706e3c4n@googlegroups.com>
Subject: Re: What do floating point words do with NAN?
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Sat, 30 Jul 2022 12:22:52 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2600
 by: minf...@arcor.de - Sat, 30 Jul 2022 12:22 UTC

dxforth schrieb am Sonntag, 24. Juli 2022 um 06:31:22 UTC+2:
> On 22/07/2022 15:16, Anton Ertl wrote:
> > dxforth <dxf...@gmail.com> writes:
> >>VFX:
> >>0e fln f. -NaN ok
> >
> > VFX Forth for Linux IA32 Version: 4.72 [build 0555]
> > Including /usr/local/VfxLinEval/Lib/x86/Ndp387.fth
> > 0e fln f. -Inf ok
> > NDP Potential Exception: NDP SW = 0004
> >
> > VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
> > © MicroProcessor Engineering Ltd, 1998-2021
> >
> > 0e fln f. Invalid argument to FLN/FLOG
> > -> 0e fln f.
> > ^
> Stephen advises the fix will be in the next release.

IEEE 754 section 9.2.1 specifies clearly
".. log(±0) is −∞ and signals the divideByZero exception .."

Reference page 43 in
https://irem.univ-reunion.fr/IMG/pdf/ieee-754-2008.pdf

Re: What do floating point words do with NAN?

<tc3md7$3tool$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19461&group=comp.lang.forth#19461

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: krishna....@ccreweb.org (Krishna Myneni)
Newsgroups: comp.lang.forth
Subject: Re: What do floating point words do with NAN?
Date: Sat, 30 Jul 2022 11:31:34 -0500
Organization: A noiseless patient Spider
Lines: 98
Message-ID: <tc3md7$3tool$1@dont-email.me>
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com>
<tapfik$2onhk$1@dont-email.me> <2022Jul18.174825@mips.complang.tuwien.ac.at>
<tb5370$rrp$1@gioia.aioe.org> <2022Jul19.101846@mips.complang.tuwien.ac.at>
<tb5v5f$hjn$1@gioia.aioe.org> <2022Jul20.134852@mips.complang.tuwien.ac.at>
<4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com>
<tbd2ia$1lqs$1@gioia.aioe.org> <2022Jul22.071641@mips.complang.tuwien.ac.at>
<tbihul$1ka2$1@gioia.aioe.org>
<3714874a-4d75-4654-94bd-d3310706e3c4n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 30 Jul 2022 16:31:36 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="4618854d53839a8482723f0b9e46e4be";
logging-data="4121365"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19pBksyvFKErggShfP+/yW4"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:q9fNWhGXFp+2oFZ4M1+HGRQ1pVM=
Content-Language: en-US
In-Reply-To: <3714874a-4d75-4654-94bd-d3310706e3c4n@googlegroups.com>
 by: Krishna Myneni - Sat, 30 Jul 2022 16:31 UTC

On 7/30/22 07:22, minf...@arcor.de wrote:
> dxforth schrieb am Sonntag, 24. Juli 2022 um 06:31:22 UTC+2:
>> On 22/07/2022 15:16, Anton Ertl wrote:
>>> dxforth <dxf...@gmail.com> writes:
>>>> VFX:
>>>> 0e fln f. -NaN ok
>>>
>>> VFX Forth for Linux IA32 Version: 4.72 [build 0555]
>>> Including /usr/local/VfxLinEval/Lib/x86/Ndp387.fth
>>> 0e fln f. -Inf ok
>>> NDP Potential Exception: NDP SW = 0004
>>>
>>> VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
>>> © MicroProcessor Engineering Ltd, 1998-2021
>>>
>>> 0e fln f. Invalid argument to FLN/FLOG
>>> -> 0e fln f.

>> ^
>> Stephen advises the fix will be in the next release.
>
> IEEE 754 section 9.2.1 specifies clearly
> ".. log(±0) is −∞ and signals the divideByZero exception .."
>
> Reference page 43 in
> https://irem.univ-reunion.fr/IMG/pdf/ieee-754-2008.pdf

The divideByZero exception mask bit must be set in order for the fpu to
signal the exception. It is not set by default.

In kForth-32/64,

\ Check ln(0)
0e f.
0 ok
0e fln f.
-inf ok

\ Check ln(-0)
-0e f.
-0 ok
-0e fln f.
-inf ok

In kForth-32, the FPU's exception mask bit for divideByZero may be set
as follows:

------
include ans-words
include strings
include modules
include syscalls
include mc
include asm-x86
include fpu-x86

cr
..( FLN of zero with default FPU exception mask ) cr

0e fln f. cr

..( Press a key to set the divideByZero FPU exception ) cr
key drop

FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86

0e fln f.
------

Output of the above code in kForth-32:
-------
$ kforth32
kForth-32 v 2.4.0 (Build: 2022-06-30)
Copyright (c) 1998--2022 Krishna Myneni
Contributions by: dpw gd mu bk abs tn cmb bg dnw
Provided under the GNU Affero General Public License, v3.0 or later

Ready!
include fpu-signals-test

FLN of zero with default FPU exception mask
-inf
Press a key to set the divideByZero FPU exception
Floating point exception (core dumped)
$ ------

We can, of course, trap the signal in kForth (see sigfpe.4th for an
example of how to trap a signal in kForth).

--
Krishna

Re: What do floating point words do with NAN?

<3aea0632-0469-4d61-9036-d56ac301d4afn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19462&group=comp.lang.forth#19462

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:c4c:b0:474:493:ca44 with SMTP id r12-20020a0562140c4c00b004740493ca44mr7737785qvj.36.1659201390828;
Sat, 30 Jul 2022 10:16:30 -0700 (PDT)
X-Received: by 2002:a05:620a:17a0:b0:6b8:72b9:ed89 with SMTP id
ay32-20020a05620a17a000b006b872b9ed89mr4894151qkb.185.1659201390600; Sat, 30
Jul 2022 10:16:30 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 30 Jul 2022 10:16:30 -0700 (PDT)
In-Reply-To: <tc3md7$3tool$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f27:a8a3:c858:ada1:2ab2:354a;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f27:a8a3:c858:ada1:2ab2:354a
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com> <tapfik$2onhk$1@dont-email.me>
<2022Jul18.174825@mips.complang.tuwien.ac.at> <tb5370$rrp$1@gioia.aioe.org>
<2022Jul19.101846@mips.complang.tuwien.ac.at> <tb5v5f$hjn$1@gioia.aioe.org>
<2022Jul20.134852@mips.complang.tuwien.ac.at> <4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com> <tbd2ia$1lqs$1@gioia.aioe.org>
<2022Jul22.071641@mips.complang.tuwien.ac.at> <tbihul$1ka2$1@gioia.aioe.org>
<3714874a-4d75-4654-94bd-d3310706e3c4n@googlegroups.com> <tc3md7$3tool$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3aea0632-0469-4d61-9036-d56ac301d4afn@googlegroups.com>
Subject: Re: What do floating point words do with NAN?
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Sat, 30 Jul 2022 17:16:30 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4673
 by: minf...@arcor.de - Sat, 30 Jul 2022 17:16 UTC

Krishna Myneni schrieb am Samstag, 30. Juli 2022 um 18:31:38 UTC+2:
> On 7/30/22 07:22, minf...@arcor.de wrote:
> > dxforth schrieb am Sonntag, 24. Juli 2022 um 06:31:22 UTC+2:
> >> On 22/07/2022 15:16, Anton Ertl wrote:
> >>> dxforth <dxf...@gmail.com> writes:
> >>>> VFX:
> >>>> 0e fln f. -NaN ok
> >>>
> >>> VFX Forth for Linux IA32 Version: 4.72 [build 0555]
> >>> Including /usr/local/VfxLinEval/Lib/x86/Ndp387.fth
> >>> 0e fln f. -Inf ok
> >>> NDP Potential Exception: NDP SW = 0004
> >>>
> >>> VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
> >>> © MicroProcessor Engineering Ltd, 1998-2021
> >>>
> >>> 0e fln f. Invalid argument to FLN/FLOG
> >>> -> 0e fln f.
>
> >> ^
> >> Stephen advises the fix will be in the next release.
> >
> > IEEE 754 section 9.2.1 specifies clearly
> > ".. log(±0) is −∞ and signals the divideByZero exception .."
> >
> > Reference page 43 in
> > https://irem.univ-reunion.fr/IMG/pdf/ieee-754-2008.pdf
> The divideByZero exception mask bit must be set in order for the fpu to
> signal the exception. It is not set by default.
>
> In kForth-32/64,
>
> \ Check ln(0)
> 0e f.
> 0 ok
> 0e fln f.
> -inf ok
>
> \ Check ln(-0)
> -0e f.
> -0 ok
> -0e fln f.
> -inf ok
>
>
> In kForth-32, the FPU's exception mask bit for divideByZero may be set
> as follows:
>
> ------
> include ans-words
> include strings
> include modules
> include syscalls
> include mc
> include asm-x86
> include fpu-x86
>
> cr
> .( FLN of zero with default FPU exception mask ) cr
>
> 0e fln f. cr
>
> .( Press a key to set the divideByZero FPU exception ) cr
> key drop
>
> FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86
>
> 0e fln f.
> ------
>
> Output of the above code in kForth-32:
> -------
> $ kforth32
> kForth-32 v 2.4.0 (Build: 2022-06-30)
> Copyright (c) 1998--2022 Krishna Myneni
> Contributions by: dpw gd mu bk abs tn cmb bg dnw
> Provided under the GNU Affero General Public License, v3.0 or later
>
>
> Ready!
> include fpu-signals-test
>
> FLN of zero with default FPU exception mask
> -inf
> Press a key to set the divideByZero FPU exception
> Floating point exception (core dumped)
> $
> ------
>
> We can, of course, trap the signal in kForth (see sigfpe.4th for an
> example of how to trap a signal in kForth).
>

Well done!

BTW I was sometimes wondering about those strange exception codes
54 and 55 in table 9.1 of the standard document. They seem a half-cooked
rudiment and practically useless.

Re: What do floating point words do with NAN?

<tc4nga$401p$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19463&group=comp.lang.forth#19463

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: krishna....@ccreweb.org (Krishna Myneni)
Newsgroups: comp.lang.forth
Subject: Re: What do floating point words do with NAN?
Date: Sat, 30 Jul 2022 20:56:24 -0500
Organization: A noiseless patient Spider
Lines: 142
Message-ID: <tc4nga$401p$1@dont-email.me>
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com>
<tapfik$2onhk$1@dont-email.me> <2022Jul18.174825@mips.complang.tuwien.ac.at>
<tb5370$rrp$1@gioia.aioe.org> <2022Jul19.101846@mips.complang.tuwien.ac.at>
<tb5v5f$hjn$1@gioia.aioe.org> <2022Jul20.134852@mips.complang.tuwien.ac.at>
<4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com>
<tbd2ia$1lqs$1@gioia.aioe.org> <2022Jul22.071641@mips.complang.tuwien.ac.at>
<tbihul$1ka2$1@gioia.aioe.org>
<3714874a-4d75-4654-94bd-d3310706e3c4n@googlegroups.com>
<tc3md7$3tool$1@dont-email.me>
<3aea0632-0469-4d61-9036-d56ac301d4afn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 31 Jul 2022 01:56:26 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="0fa280dab3361523717ad92d23566d27";
logging-data="131129"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JLz4rsCnvLCk3WX0T4uhT"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:XWmKNwP1S7veL5XiKtTC3SS872U=
In-Reply-To: <3aea0632-0469-4d61-9036-d56ac301d4afn@googlegroups.com>
Content-Language: en-US
 by: Krishna Myneni - Sun, 31 Jul 2022 01:56 UTC

On 7/30/22 12:16, minf...@arcor.de wrote:
> Krishna Myneni schrieb am Samstag, 30. Juli 2022 um 18:31:38 UTC+2:
>> On 7/30/22 07:22, minf...@arcor.de wrote:
>>> dxforth schrieb am Sonntag, 24. Juli 2022 um 06:31:22 UTC+2:
>>>> On 22/07/2022 15:16, Anton Ertl wrote:
>>>>> dxforth <dxf...@gmail.com> writes:
>>>>>> VFX:
>>>>>> 0e fln f. -NaN ok
>>>>>
>>>>> VFX Forth for Linux IA32 Version: 4.72 [build 0555]
>>>>> Including /usr/local/VfxLinEval/Lib/x86/Ndp387.fth
>>>>> 0e fln f. -Inf ok
>>>>> NDP Potential Exception: NDP SW = 0004
>>>>>
>>>>> VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
>>>>> © MicroProcessor Engineering Ltd, 1998-2021
>>>>>
>>>>> 0e fln f. Invalid argument to FLN/FLOG
>>>>> -> 0e fln f.
>>
>>>> ^
>>>> Stephen advises the fix will be in the next release.
>>>
>>> IEEE 754 section 9.2.1 specifies clearly
>>> ".. log(±0) is −∞ and signals the divideByZero exception .."
>>>
>>> Reference page 43 in
>>> https://irem.univ-reunion.fr/IMG/pdf/ieee-754-2008.pdf
>> The divideByZero exception mask bit must be set in order for the fpu to
>> signal the exception. It is not set by default.
>>
>> In kForth-32/64,
>>
>> \ Check ln(0)
>> 0e f.
>> 0 ok
>> 0e fln f.
>> -inf ok
>>
>> \ Check ln(-0)
>> -0e f.
>> -0 ok
>> -0e fln f.
>> -inf ok
>>
>>
>> In kForth-32, the FPU's exception mask bit for divideByZero may be set
>> as follows:
>>
>> ------
>> include ans-words
>> include strings
>> include modules
>> include syscalls
>> include mc
>> include asm-x86
>> include fpu-x86
>>
>> cr
>> .( FLN of zero with default FPU exception mask ) cr
>>
>> 0e fln f. cr
>>
>> .( Press a key to set the divideByZero FPU exception ) cr
>> key drop
>>
>> FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86
>>
>> 0e fln f.
>> ------
>>
>> Output of the above code in kForth-32:
>> -------
>> $ kforth32
>> kForth-32 v 2.4.0 (Build: 2022-06-30)
>> Copyright (c) 1998--2022 Krishna Myneni
>> Contributions by: dpw gd mu bk abs tn cmb bg dnw
>> Provided under the GNU Affero General Public License, v3.0 or later
>>
>>
>> Ready!
>> include fpu-signals-test
>>
>> FLN of zero with default FPU exception mask
>> -inf
>> Press a key to set the divideByZero FPU exception
>> Floating point exception (core dumped)
>> $
>> ------
>>
>> We can, of course, trap the signal in kForth (see sigfpe.4th for an
>> example of how to trap a signal in kForth).
>>
>
> Well done!
>
> BTW I was sometimes wondering about those strange exception codes
> 54 and 55 in table 9.1 of the standard document. They seem a half-cooked
> rudiment and practically useless.
>

Since Forth 2012 doesn't mandate IEEE floating point arithmetic, error
codes 54 and 55 are not specific to IEEE arithmetic specs. My guess is
that they were intended for use by processors which can provide
interrupts on such generic errors. The floating point arithmetic
exceptions which can be enabled on the x86 fpus are

INVALID
DENORMAL
ZERODIVIDE
OVERFLOW
UNDERFLOW
INEXACT

All of these, except DENORMAL, map to the IEEE standard arithmetic
exceptions. From the IEEE Std 754-2008 document,

7.2 Invalid Operation
7.3 Division by zero
7.4 Overflow
7.5 Underflow
7.6 Inexact

With regard to Table 9.1 of the Forth-94 and 2012 standards, exception
code -54 can be thrown for an x86 fpu UNDERFLOW (7.5) error. I'm not
entirely sure about when to throw exception code -55.

Note that the standard also provides the following floating point error
codes:

-41 loss of precision (I assume this is floating point?)
-42 floating-point divide by zero
-43 floating-point result out of range
-46 floating-point invalid argument

It would be good to have common practice for mapping the x86 fpu
exceptions to the standard error codes.

--
Krishna

Re: What do floating point words do with NAN?

<tc4utk$4lr1$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19465&group=comp.lang.forth#19465

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: krishna....@ccreweb.org (Krishna Myneni)
Newsgroups: comp.lang.forth
Subject: Re: What do floating point words do with NAN?
Date: Sat, 30 Jul 2022 23:02:57 -0500
Organization: A noiseless patient Spider
Lines: 104
Message-ID: <tc4utk$4lr1$1@dont-email.me>
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com>
<tapfik$2onhk$1@dont-email.me> <2022Jul18.174825@mips.complang.tuwien.ac.at>
<tb5370$rrp$1@gioia.aioe.org> <2022Jul19.101846@mips.complang.tuwien.ac.at>
<tb5v5f$hjn$1@gioia.aioe.org> <2022Jul20.134852@mips.complang.tuwien.ac.at>
<4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com>
<tbd2ia$1lqs$1@gioia.aioe.org> <2022Jul22.071641@mips.complang.tuwien.ac.at>
<tbihul$1ka2$1@gioia.aioe.org>
<3714874a-4d75-4654-94bd-d3310706e3c4n@googlegroups.com>
<tc3md7$3tool$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 31 Jul 2022 04:03:00 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="0fa280dab3361523717ad92d23566d27";
logging-data="153441"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19A7UfBQ2Oq0npyI6iYphD5"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:21qcp20JFj3lgIozmniFzwJyuVQ=
Content-Language: en-US
In-Reply-To: <tc3md7$3tool$1@dont-email.me>
 by: Krishna Myneni - Sun, 31 Jul 2022 04:02 UTC

On 7/30/22 11:31, Krishna Myneni wrote:
> On 7/30/22 07:22, minf...@arcor.de wrote:
>> dxforth schrieb am Sonntag, 24. Juli 2022 um 06:31:22 UTC+2:
>>> On 22/07/2022 15:16, Anton Ertl wrote:
>>>> dxforth <dxf...@gmail.com> writes:
>>>>> VFX:
>>>>> 0e fln f. -NaN ok
>>>>
>>>> VFX Forth for Linux IA32 Version: 4.72 [build 0555]
>>>> Including /usr/local/VfxLinEval/Lib/x86/Ndp387.fth
>>>> 0e fln f. -Inf ok
>>>> NDP Potential Exception: NDP SW = 0004
>>>>
>>>> VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
>>>> © MicroProcessor Engineering Ltd, 1998-2021
>>>>
>>>> 0e fln f. Invalid argument to FLN/FLOG
>>>> -> 0e fln f.
>
>>> ^
>>> Stephen advises the fix will be in the next release.
>>
>> IEEE 754 section 9.2.1 specifies clearly
>> ".. log(±0) is −∞ and signals the divideByZero exception .."
>>
>> Reference page 43 in
>> https://irem.univ-reunion.fr/IMG/pdf/ieee-754-2008.pdf
>
> The divideByZero exception mask bit must be set in order for the fpu to
> signal the exception. It is not set by default.
>
> In kForth-32/64,
>
> \ Check ln(0)
> 0e f.
> 0  ok
> 0e fln f.
> -inf  ok
>
> \ Check ln(-0)
> -0e f.
> -0  ok
> -0e fln f.
> -inf  ok
>
>
> In kForth-32, the FPU's exception mask bit for divideByZero may be set
> as follows:
>
> ------
> include ans-words
> include strings
> include modules
> include syscalls
> include mc
> include asm-x86
> include fpu-x86
>
> cr
> .( FLN of zero with default FPU exception mask ) cr
>
> 0e fln f. cr
>
> .( Press a key to set the divideByZero FPU exception ) cr
> key drop
>
> FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86
>

The above line of code,

FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86

is actually masking the divideByZero exception, rather than enabling it.
The program generates an exception for the odd reason that when I loaded
the strings.4th module, the fpu status register indicates an INVALID
error, caused by the following statement in strings.4th

0e 0e f/ fconstant NAN

used to define NAN for the word STRING>F .

The code is not generating an exception for the reason I thought. I
noticed this because strings.4th is not needed by any of the code, but
if I omit it, the code fails to generate an exception.

The fpu-x86.4th file permits examining the status and control registers
of the fpu as follows:

getFPUStatusX86 fpu-status ?
getFPUStateX86 fpu-control ?

Also, the word ClearFPUexceptionsX86 clears the fpu status register.

Bottom line is the code I intended to enable an exception on the fpu
divide by zero error is not correct, and only generates an exception due
to a leftover status error from somewhere else in the code. The word
modifyFPUStateX86 may be faulty.

Stay tuned.

--
KM

Re: What do floating point words do with NAN?

<tc54gc$unt$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19466&group=comp.lang.forth#19466

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: What do floating point words do with NAN?
Date: Sun, 31 Jul 2022 15:38:19 +1000
Organization: Aioe.org NNTP Server
Message-ID: <tc54gc$unt$1@gioia.aioe.org>
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com>
<tapfik$2onhk$1@dont-email.me> <2022Jul18.174825@mips.complang.tuwien.ac.at>
<tb5370$rrp$1@gioia.aioe.org> <2022Jul19.101846@mips.complang.tuwien.ac.at>
<tb5v5f$hjn$1@gioia.aioe.org> <2022Jul20.134852@mips.complang.tuwien.ac.at>
<4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com>
<tbd2ia$1lqs$1@gioia.aioe.org> <2022Jul22.071641@mips.complang.tuwien.ac.at>
<tbihul$1ka2$1@gioia.aioe.org>
<3714874a-4d75-4654-94bd-d3310706e3c4n@googlegroups.com>
<tc3md7$3tool$1@dont-email.me> <tc4utk$4lr1$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="31485"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Sun, 31 Jul 2022 05:38 UTC

On 31/07/2022 14:02, Krishna Myneni wrote:
>
> FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86
>
> is actually masking the divideByZero exception, rather than enabling it.
> The program generates an exception for the odd reason that when I loaded
> the strings.4th module, the fpu status register indicates an INVALID
> error, caused by the following statement in strings.4th
>
> 0e 0e f/ fconstant NAN
>
> used to define NAN for the word STRING>F .

The bit patterns for IEEE INF NAN are documented. Load them into PAD and F@

Re: What do floating point words do with NAN?

<tc5skd$arqo$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19472&group=comp.lang.forth#19472

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: krishna....@ccreweb.org (Krishna Myneni)
Newsgroups: comp.lang.forth
Subject: Re: What do floating point words do with NAN?
Date: Sun, 31 Jul 2022 07:30:03 -0500
Organization: A noiseless patient Spider
Lines: 78
Message-ID: <tc5skd$arqo$1@dont-email.me>
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com>
<tapfik$2onhk$1@dont-email.me> <2022Jul18.174825@mips.complang.tuwien.ac.at>
<tb5370$rrp$1@gioia.aioe.org> <2022Jul19.101846@mips.complang.tuwien.ac.at>
<tb5v5f$hjn$1@gioia.aioe.org> <2022Jul20.134852@mips.complang.tuwien.ac.at>
<4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com>
<tbd2ia$1lqs$1@gioia.aioe.org> <2022Jul22.071641@mips.complang.tuwien.ac.at>
<tbihul$1ka2$1@gioia.aioe.org>
<3714874a-4d75-4654-94bd-d3310706e3c4n@googlegroups.com>
<tc3md7$3tool$1@dont-email.me> <tc4utk$4lr1$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 31 Jul 2022 12:30:05 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="0fa280dab3361523717ad92d23566d27";
logging-data="356184"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19J1r9LWvgwZr9kqE11Nmex"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:xPSVMpkknJ6Vt5FQHC8sik5fElc=
In-Reply-To: <tc4utk$4lr1$1@dont-email.me>
Content-Language: en-US
 by: Krishna Myneni - Sun, 31 Jul 2022 12:30 UTC

On 7/30/22 23:02, Krishna Myneni wrote:
> On 7/30/22 11:31, Krishna Myneni wrote:
,,,
> FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86
>
> is actually masking the divideByZero exception, rather than enabling it.
> The program generates an exception for the odd reason that when I loaded
> the strings.4th module, the fpu status register indicates an INVALID
> error, caused by
....
> Bottom line is the code I intended to enable an exception on the fpu
> divide by zero error is not correct, and only generates an exception due
> to a leftover status error from somewhere else in the code. The word
> modifyFPUStateX86 may be faulty.
...
The word modifyFPUStateX86 works but I used it incorrectly. The
following code illustrates the working method for unmasking fpu exceptions.

fpu-signals-test.4th
-------
include ans-words
include modules
include syscalls
include mc
include asm-x86
include fpu-x86
include dump
include ssd

: unmaskFPUexceptions ( bits -- )
invert getFPUStateX86 fpu-control @ and
FPU_CW_EXCEPTION_MASK modifyFPUStateX86 ;

cr .( Press a key to mask all FPU exceptions [default] )
cr .( and compute FLN of zero )
cr key drop

0 unmaskFPUexceptions \ mask all exceptions
0e fln f. cr

cr .( Press a key to unmask the divideByZero FPU exception )
cr .( and compute FLN of zero.)
cr key drop

\ Clear current fpu exceptions before unmasking exceptions

clearFPUexceptionsX86

FPU_CW_ZERODIVIDE unmaskFPUexceptions
0e fln f.
--------

Note that I define the word unmaskFPUexceptions which takes a bit
pattern for the exceptions to be unmasked. Several exceptions may be
unmasked by or'ing the mask constants together. Also note that any
pending exceptions in the fpu's status register will immediate signal a
floating point exception if that particular exception is unmasked. If
you don't want that to happen, use clearFPUexceptionsX86 before
executing unmaskFPUexceptions, as illustrated above.

Output of the above code in kforth32 is given below.

------
include fpu-signals-test

Press a key to mask all FPU exceptions [default]
and compute FLN of zero
-inf

Press a key to unmask the divideByZero FPU exception
and compute FLN of zero.
Floating point exception (core dumped)
$ --------

--
Krishna Myneni

Re: What do floating point words do with NAN?

<tc5st9$asv8$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19473&group=comp.lang.forth#19473

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: krishna....@ccreweb.org (Krishna Myneni)
Newsgroups: comp.lang.forth
Subject: Re: What do floating point words do with NAN?
Date: Sun, 31 Jul 2022 07:34:47 -0500
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <tc5st9$asv8$1@dont-email.me>
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com>
<tapfik$2onhk$1@dont-email.me> <2022Jul18.174825@mips.complang.tuwien.ac.at>
<tb5370$rrp$1@gioia.aioe.org> <2022Jul19.101846@mips.complang.tuwien.ac.at>
<tb5v5f$hjn$1@gioia.aioe.org> <2022Jul20.134852@mips.complang.tuwien.ac.at>
<4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com>
<tbd2ia$1lqs$1@gioia.aioe.org> <2022Jul22.071641@mips.complang.tuwien.ac.at>
<tbihul$1ka2$1@gioia.aioe.org>
<3714874a-4d75-4654-94bd-d3310706e3c4n@googlegroups.com>
<tc3md7$3tool$1@dont-email.me> <tc4utk$4lr1$1@dont-email.me>
<tc54gc$unt$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 31 Jul 2022 12:34:49 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="0fa280dab3361523717ad92d23566d27";
logging-data="357352"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rPaadI2f5b2NER+HEYIZv"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:dewbLcRMRta2ynANN4QkLmIF3YI=
Content-Language: en-US
In-Reply-To: <tc54gc$unt$1@gioia.aioe.org>
 by: Krishna Myneni - Sun, 31 Jul 2022 12:34 UTC

On 7/31/22 00:38, dxforth wrote:
> On 31/07/2022 14:02, Krishna Myneni wrote:
>>
>> FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86
>>
>> is actually masking the divideByZero exception, rather than enabling it.
>> The program generates an exception for the odd reason that when I loaded
>> the strings.4th module, the fpu status register indicates an INVALID
>> error, caused by the following statement in strings.4th
>>
>> 0e 0e f/ fconstant NAN
>>
>> used to define NAN for the word STRING>F .
>
> The bit patterns for IEEE INF NAN are documented. Load them into PAD and F@
>

Agreed that it's better to load the bit pattern for NAN than to actually
generate exception(s) which are stored in the FPU status register and
can later trigger a floating point exception if the particular
exception(s) are unmasked. The alternative is to clear the FPU status
register after generating the exceptions.

--
Krishna

Re: What do floating point words do with NAN?

<tc5uk4$b9ea$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19474&group=comp.lang.forth#19474

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: krishna....@ccreweb.org (Krishna Myneni)
Newsgroups: comp.lang.forth
Subject: Re: What do floating point words do with NAN?
Date: Sun, 31 Jul 2022 08:04:02 -0500
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <tc5uk4$b9ea$1@dont-email.me>
References: <1f9b7495-91de-4063-ad0e-480a5a438cd8n@googlegroups.com>
<5067298c-db15-408e-8403-58dbae82f1f6n@googlegroups.com>
<tapfik$2onhk$1@dont-email.me> <2022Jul18.174825@mips.complang.tuwien.ac.at>
<tb5370$rrp$1@gioia.aioe.org> <2022Jul19.101846@mips.complang.tuwien.ac.at>
<tb5v5f$hjn$1@gioia.aioe.org> <2022Jul20.134852@mips.complang.tuwien.ac.at>
<4b7f9ec7-b762-4168-aa42-b93c910dc386n@googlegroups.com>
<1c307235-ae20-4488-ae4e-861e5d836b2bn@googlegroups.com>
<tbd2ia$1lqs$1@gioia.aioe.org> <2022Jul22.071641@mips.complang.tuwien.ac.at>
<tbihul$1ka2$1@gioia.aioe.org>
<3714874a-4d75-4654-94bd-d3310706e3c4n@googlegroups.com>
<tc3md7$3tool$1@dont-email.me> <tc4utk$4lr1$1@dont-email.me>
<tc5skd$arqo$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 31 Jul 2022 13:04:04 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="0fa280dab3361523717ad92d23566d27";
logging-data="370122"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ReHry9ZdAe9hSK7sJNtd7"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:kRpV8CsbJxRUGa+1som7YicMMec=
Content-Language: en-US
In-Reply-To: <tc5skd$arqo$1@dont-email.me>
 by: Krishna Myneni - Sun, 31 Jul 2022 13:04 UTC

On 7/31/22 07:30, Krishna Myneni wrote:
> On 7/30/22 23:02, Krishna Myneni wrote:
....
> 0 unmaskFPUexceptions \ mask all exceptions
....

Sigh. I just realized that the above line is bad logic. It does not mask
all fpu exceptions. It has no effect on the mask pattern. Corrected
code, using the definition maskAllFPUexceptions, is given below.

fpu-signals-test.4th
------
include ans-words
include modules
include syscalls
include mc
include asm-x86
include fpu-x86

: maskAllFPUexceptions ( -- )
FPU_CW_INVALID
FPU_CW_DENORMAL or
FPU_CW_ZERODIVIDE or
FPU_CW_OVERFLOW or
FPU_CW_UNDERFLOW or
FPU_CW_INEXACT or
FPU_CW_EXCEPTION_MASK modifyFPUStateX86 ;

: unmaskFPUexceptions ( bits -- )
invert getFPUStateX86 fpu-control @ and
FPU_CW_EXCEPTION_MASK modifyFPUStateX86 ;

cr .( Press a key to mask all FPU exceptions [default] )
cr .( and compute FLN of zero )
cr key drop

maskAllFPUexceptions
0e fln f. cr

cr .( Press a key to unmask the divideByZero FPU exception )
cr .( and compute FLN of zero.)
cr key drop

\ Clear current fpu exceptions before unmasking exceptions

clearFPUexceptionsX86

FPU_CW_ZERODIVIDE unmaskFPUexceptions
0e fln f.
-------

KM

Pages:123
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor