Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"It is easier to port a shell than a shell script." -- Larry Wall


devel / comp.lang.prolog / Re: Does a Prolog system use StrictMath or Math?

SubjectAuthor
* Does a Prolog system use StrictMath or Math?Mostowski Collapse
`* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
 `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
  `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
   `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
    `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
     `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
      `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
       `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
        `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
         `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
          `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
           `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
            `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
             `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
              `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
               `* Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
                +- Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
                +- Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse
                `- Re: Does a Prolog system use StrictMath or Math?Mostowski Collapse

1
Does a Prolog system use StrictMath or Math?

<c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1202&group=comp.lang.prolog#1202

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6214:21cf:b0:42d:cc:4121 with SMTP id d15-20020a05621421cf00b0042d00cc4121mr15235763qvh.70.1647851218845;
Mon, 21 Mar 2022 01:26:58 -0700 (PDT)
X-Received: by 2002:a0d:e24c:0:b0:2e5:bf17:4dce with SMTP id
l73-20020a0de24c000000b002e5bf174dcemr19888789ywe.130.1647851218676; Mon, 21
Mar 2022 01:26:58 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Mon, 21 Mar 2022 01:26:58 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
Subject: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Mon, 21 Mar 2022 08:26:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Mostowski Collapse - Mon, 21 Mar 2022 08:26 UTC

As soon as I get my head out of the Ukraine conflict,
and start doing Prolog, my sixth sense of stepping into
corner cases starts working again. Eh voilà while doing

some regression testing I found:

/* Math, -0.6662760212798241 */
cos(2.3) = 0xbfe5522217302fe1

Versus:

/* StrictMath, -0.666276021279824 */
cos(2.3) = 0xbfe5522217302fe0

There are some Prolog systems which side with Math and not with
StrictMath. For example Scryer Prolog and ECLiPSe Prolog. But then
some side with StrictMath like Tau Prolog, Dogelog and GNU Prolog.

Re: Does a Prolog system use StrictMath or Math?

<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1203&group=comp.lang.prolog#1203

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:a24a:0:b0:67b:4836:fe95 with SMTP id l71-20020a37a24a000000b0067b4836fe95mr12040749qke.109.1647851319823;
Mon, 21 Mar 2022 01:28:39 -0700 (PDT)
X-Received: by 2002:a25:c884:0:b0:633:7961:8a06 with SMTP id
y126-20020a25c884000000b0063379618a06mr21543058ybf.38.1647851319570; Mon, 21
Mar 2022 01:28:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Mon, 21 Mar 2022 01:28:39 -0700 (PDT)
In-Reply-To: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Mon, 21 Mar 2022 08:28:39 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Mostowski Collapse - Mon, 21 Mar 2022 08:28 UTC

Is there maybe a flag where the strictness can be queried or controlled?

I can produce the different two return values in Java JDK 16
Windows 10, by either using the Java class StrictMath or Math.
Now I found that such a discrepancy also exists across Prolog

systems. Math is characterized as:

Unlike some of the numeric methods of class StrictMath , all
implementations of the equivalent functions of class Math are
not defined to return the bit-for-bit same results. This relaxation
permits better-performing implementations where strict
reproducibility is not required.
https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Math.html

Mostowski Collapse schrieb am Montag, 21. März 2022 um 09:26:59 UTC+1:
> As soon as I get my head out of the Ukraine conflict,
> and start doing Prolog, my sixth sense of stepping into
> corner cases starts working again. Eh voilà while doing
>
> some regression testing I found:
>
> /* Math, -0.6662760212798241 */
> cos(2.3) = 0xbfe5522217302fe1
>
> Versus:
>
> /* StrictMath, -0.666276021279824 */
> cos(2.3) = 0xbfe5522217302fe0
>
> There are some Prolog systems which side with Math and not with
> StrictMath. For example Scryer Prolog and ECLiPSe Prolog. But then
> some side with StrictMath like Tau Prolog, Dogelog and GNU Prolog.

Re: Does a Prolog system use StrictMath or Math?

<782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1204&group=comp.lang.prolog#1204

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:41:b0:2e1:df22:358 with SMTP id y1-20020a05622a004100b002e1df220358mr15958606qtw.186.1647862935883;
Mon, 21 Mar 2022 04:42:15 -0700 (PDT)
X-Received: by 2002:a5b:dc8:0:b0:624:a898:dea6 with SMTP id
t8-20020a5b0dc8000000b00624a898dea6mr20938085ybr.600.1647862935251; Mon, 21
Mar 2022 04:42:15 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Mon, 21 Mar 2022 04:42:15 -0700 (PDT)
In-Reply-To: <cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com> <cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Mon, 21 Mar 2022 11:42:15 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Mostowski Collapse - Mon, 21 Mar 2022 11:42 UTC

I don’t know what Dodgelog should be, I only know about Dogelog.
But on 64-bit Intel, the Math cos() is simply these op-codes:

0xD9 0xFF
http://ref.x86asm.net/coder64.html

That is what JDK 16 in Math mode seems to use. According to
JDK-8143353 the performance gain is ~4.25x with both sin and cos.

https://bugs.openjdk.java.net/browse/JDK-8143353

But I did not yet do some performance measures. Also I did not
verify first hand by myself that this opcode really gives the different value.

Mostowski Collapse schrieb am Montag, 21. März 2022 um 09:28:40 UTC+1:
> Is there maybe a flag where the strictness can be queried or controlled?
>
> I can produce the different two return values in Java JDK 16
> Windows 10, by either using the Java class StrictMath or Math.
> Now I found that such a discrepancy also exists across Prolog
>
> systems. Math is characterized as:
>
> Unlike some of the numeric methods of class StrictMath , all
> implementations of the equivalent functions of class Math are
> not defined to return the bit-for-bit same results. This relaxation
> permits better-performing implementations where strict
> reproducibility is not required.
> https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Math.html
> Mostowski Collapse schrieb am Montag, 21. März 2022 um 09:26:59 UTC+1:
> > As soon as I get my head out of the Ukraine conflict,
> > and start doing Prolog, my sixth sense of stepping into
> > corner cases starts working again. Eh voilà while doing
> >
> > some regression testing I found:
> >
> > /* Math, -0.6662760212798241 */
> > cos(2.3) = 0xbfe5522217302fe1
> >
> > Versus:
> >
> > /* StrictMath, -0.666276021279824 */
> > cos(2.3) = 0xbfe5522217302fe0
> >
> > There are some Prolog systems which side with Math and not with
> > StrictMath. For example Scryer Prolog and ECLiPSe Prolog. But then
> > some side with StrictMath like Tau Prolog, Dogelog and GNU Prolog.

Re: Does a Prolog system use StrictMath or Math?

<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1206&group=comp.lang.prolog#1206

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:24f:b0:2e1:d658:a595 with SMTP id c15-20020a05622a024f00b002e1d658a595mr18923853qtx.657.1647933671067;
Tue, 22 Mar 2022 00:21:11 -0700 (PDT)
X-Received: by 2002:a0d:f602:0:b0:2dc:6eaa:64 with SMTP id g2-20020a0df602000000b002dc6eaa0064mr27249440ywf.451.1647933670870;
Tue, 22 Mar 2022 00:21:10 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Tue, 22 Mar 2022 00:21:10 -0700 (PDT)
In-Reply-To: <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 22 Mar 2022 07:21:11 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 75
 by: Mostowski Collapse - Tue, 22 Mar 2022 07:21 UTC

So what is the correct value? Interestingly its not from StrictMath:

So when we use the nearest double to 2.3, the exact value of cos is
inbetween the two, but it is nearer to -0.6662760212798241. One
can use some multi-precision MatLab arithmetic or these queries
here where mp/2 is for multi-precision,

that this value is nearer and that cos is inbetween:

?- X is mp(cos(2.3)- -0.6662760212798241, 50).
X = 0d4.355007402796814766458012027899645E-17.

?- X is mp(cos(2.3)- -0.666276021279824, 50).
X = -0d6.747222843454750637778304653008558E-17.

In the above I didn’t use decimal/1 conversion evaluable function
anymore, mp/2 does this automatically when it sees a double, i.e. a
number that is not a decimal that starts with the special
number prefix 0d.

Not sure why StrictMath gives a different value...

Mostowski Collapse schrieb am Montag, 21. März 2022 um 12:42:16 UTC+1:
> I don’t know what Dodgelog should be, I only know about Dogelog.
> But on 64-bit Intel, the Math cos() is simply these op-codes:
>
> 0xD9 0xFF
> http://ref.x86asm.net/coder64.html
>
> That is what JDK 16 in Math mode seems to use. According to
> JDK-8143353 the performance gain is ~4.25x with both sin and cos.
>
> https://bugs.openjdk.java.net/browse/JDK-8143353
>
> But I did not yet do some performance measures. Also I did not
> verify first hand by myself that this opcode really gives the different value.
> Mostowski Collapse schrieb am Montag, 21. März 2022 um 09:28:40 UTC+1:
> > Is there maybe a flag where the strictness can be queried or controlled?
> >
> > I can produce the different two return values in Java JDK 16
> > Windows 10, by either using the Java class StrictMath or Math.
> > Now I found that such a discrepancy also exists across Prolog
> >
> > systems. Math is characterized as:
> >
> > Unlike some of the numeric methods of class StrictMath , all
> > implementations of the equivalent functions of class Math are
> > not defined to return the bit-for-bit same results. This relaxation
> > permits better-performing implementations where strict
> > reproducibility is not required.
> > https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Math.html
> > Mostowski Collapse schrieb am Montag, 21. März 2022 um 09:26:59 UTC+1:
> > > As soon as I get my head out of the Ukraine conflict,
> > > and start doing Prolog, my sixth sense of stepping into
> > > corner cases starts working again. Eh voilà while doing
> > >
> > > some regression testing I found:
> > >
> > > /* Math, -0.6662760212798241 */
> > > cos(2.3) = 0xbfe5522217302fe1
> > >
> > > Versus:
> > >
> > > /* StrictMath, -0.666276021279824 */
> > > cos(2.3) = 0xbfe5522217302fe0
> > >
> > > There are some Prolog systems which side with Math and not with
> > > StrictMath. For example Scryer Prolog and ECLiPSe Prolog. But then
> > > some side with StrictMath like Tau Prolog, Dogelog and GNU Prolog.

Re: Does a Prolog system use StrictMath or Math?

<09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1208&group=comp.lang.prolog#1208

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:4309:b0:67b:3fc1:86eb with SMTP id u9-20020a05620a430900b0067b3fc186ebmr1383442qko.495.1648073036010;
Wed, 23 Mar 2022 15:03:56 -0700 (PDT)
X-Received: by 2002:a25:fd4:0:b0:628:f1b9:cf1e with SMTP id
203-20020a250fd4000000b00628f1b9cf1emr2172725ybp.104.1648073035833; Wed, 23
Mar 2022 15:03:55 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Wed, 23 Mar 2022 15:03:55 -0700 (PDT)
In-Reply-To: <83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 23 Mar 2022 22:03:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 40
 by: Mostowski Collapse - Wed, 23 Mar 2022 22:03 UTC

Somebody brought round() on the table on SWI-Prolog discourse.

Now I am baffled, I get:

/* Formerly Jekejeke, a little Math.round() */
?- X is 0.5, Y is round(X).
X = 0.5, Y = 1.0.
?- X is -0.5, Y is round(X).
X = -0.5, Y = -1.0.
?- X is 1.5, Y is round(X).
X = 1.5, Y = 2.0.
?- X is -1.5, Y is round(X).
X = -1.5, Y = -2.0.

/* Dogelog JavaScript */
?- X is 0.5, Y is round(X).
X = 0.5, Y = 1.0.
?- X is -0.5, Y is round(X).
X = -0.5, Y = 0.0.
?- X is 1.5, Y is round(X).
X = 1.5, Y = 2.0.
?- X is -1.5, Y is round(X).
X = -1.5, Y = -1.0.

/* Dogelog Python */
?- X is 0.5, Y is round(X).
X = 0.5, Y = 0.0.
?- X is -0.5, Y is round(X).
X = -0.5, Y = 0.0.
?- X is 1.5, Y is round(X).
X = 1.5, Y = 2.0.
?- X is -1.5, Y is round(X).
X = -1.5, Y = -2.0.

The JavaScript thingy can easily be fixed, but the Python thingy?

LoL

Mostowski Collapse schrieb am Dienstag, 22. März 2022 um 08:21:12 UTC+1:
> So what is the correct value? Interestingly its not from StrictMath:

Re: Does a Prolog system use StrictMath or Math?

<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1209&group=comp.lang.prolog#1209

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6214:21a9:b0:440:ff7f:5364 with SMTP id t9-20020a05621421a900b00440ff7f5364mr1744835qvc.61.1648074058173;
Wed, 23 Mar 2022 15:20:58 -0700 (PDT)
X-Received: by 2002:a25:e30a:0:b0:625:3d53:91b7 with SMTP id
z10-20020a25e30a000000b006253d5391b7mr2148722ybd.499.1648074057983; Wed, 23
Mar 2022 15:20:57 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Wed, 23 Mar 2022 15:20:57 -0700 (PDT)
In-Reply-To: <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 23 Mar 2022 22:20:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 53
 by: Mostowski Collapse - Wed, 23 Mar 2022 22:20 UTC

In Jekejeke Prolog we use (d < 0 ? -Math.round(-d) : Math.round(d)).
This is done to be compatible with SWI-Prolog.

Interestingly, ECLiPSe Prolog does this border cases like Python,
and Tau Prolog does it like JavaScript.

Where is Logtalk with its many test cases, shouldn't
by now all Prolog systems behave the same thanks

to the enduring path of glory of Logtalk? LoL

Mostowski Collapse schrieb am Mittwoch, 23. März 2022 um 23:03:57 UTC+1:
> Somebody brought round() on the table on SWI-Prolog discourse.
>
> Now I am baffled, I get:
>
> /* Formerly Jekejeke, a little Math.round() */
> ?- X is 0.5, Y is round(X).
> X = 0.5, Y = 1.0.
> ?- X is -0.5, Y is round(X).
> X = -0.5, Y = -1.0.
> ?- X is 1.5, Y is round(X).
> X = 1.5, Y = 2.0.
> ?- X is -1.5, Y is round(X).
> X = -1.5, Y = -2.0.
>
> /* Dogelog JavaScript */
> ?- X is 0.5, Y is round(X).
> X = 0.5, Y = 1.0.
> ?- X is -0.5, Y is round(X).
> X = -0.5, Y = 0.0.
> ?- X is 1.5, Y is round(X).
> X = 1.5, Y = 2.0.
> ?- X is -1.5, Y is round(X).
> X = -1.5, Y = -1.0.
>
> /* Dogelog Python */
> ?- X is 0.5, Y is round(X).
> X = 0.5, Y = 0.0.
> ?- X is -0.5, Y is round(X).
> X = -0.5, Y = 0.0.
> ?- X is 1.5, Y is round(X).
> X = 1.5, Y = 2.0.
> ?- X is -1.5, Y is round(X).
> X = -1.5, Y = -2.0.
>
> The JavaScript thingy can easily be fixed, but the Python thingy?
>
> LoL
> Mostowski Collapse schrieb am Dienstag, 22. März 2022 um 08:21:12 UTC+1:
> > So what is the correct value? Interestingly its not from StrictMath:

Re: Does a Prolog system use StrictMath or Math?

<3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1210&group=comp.lang.prolog#1210

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ad4:5961:0:b0:435:a1d7:c243 with SMTP id eq1-20020ad45961000000b00435a1d7c243mr1824775qvb.46.1648076083233;
Wed, 23 Mar 2022 15:54:43 -0700 (PDT)
X-Received: by 2002:a25:8c01:0:b0:634:712d:3def with SMTP id
k1-20020a258c01000000b00634712d3defmr2300155ybl.343.1648076083040; Wed, 23
Mar 2022 15:54:43 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Wed, 23 Mar 2022 15:54:42 -0700 (PDT)
In-Reply-To: <3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 23 Mar 2022 22:54:43 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 80
 by: Mostowski Collapse - Wed, 23 Mar 2022 22:54 UTC

This is also a funny test case:

/* Formerly Jekejeke, a little Math.round() */
?- X is round(1.0e+32).
X = 1.0E32.
/* Dogelog JavaScript */
?- X is round(1.0e+32).
X = 1.0E32.
/* Dogelog Python */
?- X is round(1.0e+32).
X = 1.0E32.
/* ECLiPSe Prolog */
[eclipse 1]: X is round(1.0e+32).
X = 1e+32

Half of the Prolog systems cannot parse the ECLiPSe answer.

/* SWI-Prolog */
?- X is round(1.0e+32).
X = 100000000000000005366162204393472.
/* Tau Prolog */
?- X is round(1.0e+32).
uncaught exception: error(evaluation_error(int_overflow),is/2)
/* Scryer Prolog */
?- X is round(1.0e+32).
X = 9223372036854775807.

Mostowski Collapse schrieb am Mittwoch, 23. März 2022 um 23:20:59 UTC+1:
> In Jekejeke Prolog we use (d < 0 ? -Math.round(-d) : Math.round(d)).
> This is done to be compatible with SWI-Prolog.
>
> Interestingly, ECLiPSe Prolog does this border cases like Python,
> and Tau Prolog does it like JavaScript.
>
> Where is Logtalk with its many test cases, shouldn't
> by now all Prolog systems behave the same thanks
>
> to the enduring path of glory of Logtalk? LoL
> Mostowski Collapse schrieb am Mittwoch, 23. März 2022 um 23:03:57 UTC+1:
> > Somebody brought round() on the table on SWI-Prolog discourse.
> >
> > Now I am baffled, I get:
> >
> > /* Formerly Jekejeke, a little Math.round() */
> > ?- X is 0.5, Y is round(X).
> > X = 0.5, Y = 1.0.
> > ?- X is -0.5, Y is round(X).
> > X = -0.5, Y = -1.0.
> > ?- X is 1.5, Y is round(X).
> > X = 1.5, Y = 2.0.
> > ?- X is -1.5, Y is round(X).
> > X = -1.5, Y = -2.0.
> >
> > /* Dogelog JavaScript */
> > ?- X is 0.5, Y is round(X).
> > X = 0.5, Y = 1.0.
> > ?- X is -0.5, Y is round(X).
> > X = -0.5, Y = 0.0.
> > ?- X is 1.5, Y is round(X).
> > X = 1.5, Y = 2.0.
> > ?- X is -1.5, Y is round(X).
> > X = -1.5, Y = -1.0.
> >
> > /* Dogelog Python */
> > ?- X is 0.5, Y is round(X).
> > X = 0.5, Y = 0.0.
> > ?- X is -0.5, Y is round(X).
> > X = -0.5, Y = 0.0.
> > ?- X is 1.5, Y is round(X).
> > X = 1.5, Y = 2.0.
> > ?- X is -1.5, Y is round(X).
> > X = -1.5, Y = -2.0.
> >
> > The JavaScript thingy can easily be fixed, but the Python thingy?
> >
> > LoL
> > Mostowski Collapse schrieb am Dienstag, 22. März 2022 um 08:21:12 UTC+1:
> > > So what is the correct value? Interestingly its not from StrictMath:

Re: Does a Prolog system use StrictMath or Math?

<b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1212&group=comp.lang.prolog#1212

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6214:625:b0:441:1578:620b with SMTP id a5-20020a056214062500b004411578620bmr3420750qvx.126.1648118491474;
Thu, 24 Mar 2022 03:41:31 -0700 (PDT)
X-Received: by 2002:a81:517:0:b0:2e6:af62:b11 with SMTP id 23-20020a810517000000b002e6af620b11mr4206715ywf.234.1648118491088;
Thu, 24 Mar 2022 03:41:31 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Thu, 24 Mar 2022 03:41:30 -0700 (PDT)
In-Reply-To: <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com> <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 24 Mar 2022 10:41:31 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 9
 by: Mostowski Collapse - Thu, 24 Mar 2022 10:41 UTC

Ha Ha, Logtalk Nonsense is as real as a Pink Unicorn.

If they would really have all these adapters and their
test suite, they would have by long already detected this bug:

round() result #1365
https://github.com/mthom/scryer-prolog/issues/1365

LoL

Re: Does a Prolog system use StrictMath or Math?

<5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1213&group=comp.lang.prolog#1213

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:120a:b0:2e1:c9ba:e99b with SMTP id y10-20020a05622a120a00b002e1c9bae99bmr3710515qtx.685.1648118645943;
Thu, 24 Mar 2022 03:44:05 -0700 (PDT)
X-Received: by 2002:a81:e8b:0:b0:2e5:b8fe:af19 with SMTP id
133-20020a810e8b000000b002e5b8feaf19mr3935608ywo.378.1648118645755; Thu, 24
Mar 2022 03:44:05 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Thu, 24 Mar 2022 03:44:05 -0700 (PDT)
In-Reply-To: <b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com> <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
<b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 24 Mar 2022 10:44:05 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 24
 by: Mostowski Collapse - Thu, 24 Mar 2022 10:44 UTC

Because the test is from here:

real(1.0e+32).
test(lgt_unbounded_round_01, true(integer(N))) :-
real(Value),
N is round(Value).
https://github.com/LogtalkDotOrg/logtalk3/blob/master/tests/prolog/unbounded/tests.lgt

But the test doesn't make any sense obviously,
only testing whether a result is integer, and not what
it is particularly.

Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:41:32 UTC+1:
> Ha Ha, Logtalk Nonsense is as real as a Pink Unicorn.
>
> If they would really have all these adapters and their
> test suite, they would have by long already detected this bug:
>
> round() result #1365
> https://github.com/mthom/scryer-prolog/issues/1365
>
> LoL

Re: Does a Prolog system use StrictMath or Math?

<898fd5de-3e22-463b-b0d4-80fd3e3b78ben@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1214&group=comp.lang.prolog#1214

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:1386:b0:67e:46c1:1b33 with SMTP id k6-20020a05620a138600b0067e46c11b33mr2777957qki.53.1648118720657;
Thu, 24 Mar 2022 03:45:20 -0700 (PDT)
X-Received: by 2002:a81:19c4:0:b0:2e5:d2cc:aad2 with SMTP id
187-20020a8119c4000000b002e5d2ccaad2mr3927721ywz.245.1648118720458; Thu, 24
Mar 2022 03:45:20 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Thu, 24 Mar 2022 03:45:20 -0700 (PDT)
In-Reply-To: <5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com> <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
<b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com> <5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <898fd5de-3e22-463b-b0d4-80fd3e3b78ben@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 24 Mar 2022 10:45:20 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 36
 by: Mostowski Collapse - Thu, 24 Mar 2022 10:45 UTC

But round is really a can of worms. Just out of curiousity I was
checking out the ISO core standard, and it tells me:

round(x) = floor(x+1/2)

For example my definition of round function usually says,
and what SWI-Prolog possibly implemented so far:

round(x) = truncate(x + sign(x)*1/2)

And not what the ISO core standard gives.

Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:44:06 UTC+1:
> Because the test is from here:
>
> real(1.0e+32).
> test(lgt_unbounded_round_01, true(integer(N))) :-
> real(Value),
> N is round(Value).
> https://github.com/LogtalkDotOrg/logtalk3/blob/master/tests/prolog/unbounded/tests.lgt
>
> But the test doesn't make any sense obviously,
> only testing whether a result is integer, and not what
> it is particularly.
> Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:41:32 UTC+1:
> > Ha Ha, Logtalk Nonsense is as real as a Pink Unicorn.
> >
> > If they would really have all these adapters and their
> > test suite, they would have by long already detected this bug:
> >
> > round() result #1365
> > https://github.com/mthom/scryer-prolog/issues/1365
> >
> > LoL

Re: Does a Prolog system use StrictMath or Math?

<2c0fd3f0-cab7-47f9-a5c2-b15c3e78f6d8n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1215&group=comp.lang.prolog#1215

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ae9:ed03:0:b0:67e:9830:93d7 with SMTP id c3-20020ae9ed03000000b0067e983093d7mr2757304qkg.527.1648118891883;
Thu, 24 Mar 2022 03:48:11 -0700 (PDT)
X-Received: by 2002:a81:99c4:0:b0:2e6:acdf:4c90 with SMTP id
q187-20020a8199c4000000b002e6acdf4c90mr4000652ywg.125.1648118891658; Thu, 24
Mar 2022 03:48:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Thu, 24 Mar 2022 03:48:11 -0700 (PDT)
In-Reply-To: <898fd5de-3e22-463b-b0d4-80fd3e3b78ben@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com> <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
<b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com> <5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>
<898fd5de-3e22-463b-b0d4-80fd3e3b78ben@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2c0fd3f0-cab7-47f9-a5c2-b15c3e78f6d8n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 24 Mar 2022 10:48:11 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 52
 by: Mostowski Collapse - Thu, 24 Mar 2022 10:48 UTC

Does it make a difference. Well you can check yourself:
So I made some additional tests, first Scryer Prolog v0.8.123:

?- X is round(0.5).
X = 1.
?- X is round(-0.5).
X = 0.

And then SWI-Prolog 8.5.8:

?- X is round(0.5).
X = 1.
?- X is round(-0.5).
X = -1.

Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:45:21 UTC+1:
> But round is really a can of worms. Just out of curiousity I was
> checking out the ISO core standard, and it tells me:
>
> round(x) = floor(x+1/2)
>
> For example my definition of round function usually says,
> and what SWI-Prolog possibly implemented so far:
>
> round(x) = truncate(x + sign(x)*1/2)
>
> And not what the ISO core standard gives.
> Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:44:06 UTC+1:
> > Because the test is from here:
> >
> > real(1.0e+32).
> > test(lgt_unbounded_round_01, true(integer(N))) :-
> > real(Value),
> > N is round(Value).
> > https://github.com/LogtalkDotOrg/logtalk3/blob/master/tests/prolog/unbounded/tests.lgt
> >
> > But the test doesn't make any sense obviously,
> > only testing whether a result is integer, and not what
> > it is particularly.
> > Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:41:32 UTC+1:
> > > Ha Ha, Logtalk Nonsense is as real as a Pink Unicorn.
> > >
> > > If they would really have all these adapters and their
> > > test suite, they would have by long already detected this bug:
> > >
> > > round() result #1365
> > > https://github.com/mthom/scryer-prolog/issues/1365
> > >
> > > LoL

Re: Does a Prolog system use StrictMath or Math?

<ae7c33d4-d0e7-4f49-8a4c-6138df1fc81cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1216&group=comp.lang.prolog#1216

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:450f:b0:67d:b1ee:bd3 with SMTP id t15-20020a05620a450f00b0067db1ee0bd3mr2768838qkp.766.1648119696997;
Thu, 24 Mar 2022 04:01:36 -0700 (PDT)
X-Received: by 2002:a81:5743:0:b0:2e5:bcb2:625 with SMTP id
l64-20020a815743000000b002e5bcb20625mr3979182ywb.34.1648119696780; Thu, 24
Mar 2022 04:01:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Thu, 24 Mar 2022 04:01:36 -0700 (PDT)
In-Reply-To: <2c0fd3f0-cab7-47f9-a5c2-b15c3e78f6d8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com> <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
<b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com> <5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>
<898fd5de-3e22-463b-b0d4-80fd3e3b78ben@googlegroups.com> <2c0fd3f0-cab7-47f9-a5c2-b15c3e78f6d8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ae7c33d4-d0e7-4f49-8a4c-6138df1fc81cn@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 24 Mar 2022 11:01:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 60
 by: Mostowski Collapse - Thu, 24 Mar 2022 11:01 UTC

Thats quite an amazing scale of failure by Logtalk Nonsense,
given the fact that it promoted QuickCheck. Almost as cring

as the failed Invasion of Ukraine by Russia. Unfortunately
Europe gets now fucked up by US via NATO?

Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:48:12 UTC+1:
> Does it make a difference. Well you can check yourself:
> So I made some additional tests, first Scryer Prolog v0.8.123:
>
> ?- X is round(0.5).
> X = 1.
> ?- X is round(-0.5).
> X = 0.
>
> And then SWI-Prolog 8.5.8:
>
> ?- X is round(0.5).
> X = 1.
> ?- X is round(-0.5).
> X = -1.
> Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:45:21 UTC+1:
> > But round is really a can of worms. Just out of curiousity I was
> > checking out the ISO core standard, and it tells me:
> >
> > round(x) = floor(x+1/2)
> >
> > For example my definition of round function usually says,
> > and what SWI-Prolog possibly implemented so far:
> >
> > round(x) = truncate(x + sign(x)*1/2)
> >
> > And not what the ISO core standard gives.
> > Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:44:06 UTC+1:
> > > Because the test is from here:
> > >
> > > real(1.0e+32).
> > > test(lgt_unbounded_round_01, true(integer(N))) :-
> > > real(Value),
> > > N is round(Value).
> > > https://github.com/LogtalkDotOrg/logtalk3/blob/master/tests/prolog/unbounded/tests.lgt
> > >
> > > But the test doesn't make any sense obviously,
> > > only testing whether a result is integer, and not what
> > > it is particularly.
> > > Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:41:32 UTC+1:
> > > > Ha Ha, Logtalk Nonsense is as real as a Pink Unicorn.
> > > >
> > > > If they would really have all these adapters and their
> > > > test suite, they would have by long already detected this bug:
> > > >
> > > > round() result #1365
> > > > https://github.com/mthom/scryer-prolog/issues/1365
> > > >
> > > > LoL

Re: Does a Prolog system use StrictMath or Math?

<825e2cbf-ecbf-49c3-891e-2ee73e45bac9n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1217&group=comp.lang.prolog#1217

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:5889:0:b0:2e1:afa2:65a9 with SMTP id t9-20020ac85889000000b002e1afa265a9mr3698251qta.268.1648119944049;
Thu, 24 Mar 2022 04:05:44 -0700 (PDT)
X-Received: by 2002:a81:360d:0:b0:2e5:827a:98db with SMTP id
d13-20020a81360d000000b002e5827a98dbmr4391747ywa.49.1648119943837; Thu, 24
Mar 2022 04:05:43 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.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.prolog
Date: Thu, 24 Mar 2022 04:05:43 -0700 (PDT)
In-Reply-To: <ae7c33d4-d0e7-4f49-8a4c-6138df1fc81cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com> <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
<b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com> <5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>
<898fd5de-3e22-463b-b0d4-80fd3e3b78ben@googlegroups.com> <2c0fd3f0-cab7-47f9-a5c2-b15c3e78f6d8n@googlegroups.com>
<ae7c33d4-d0e7-4f49-8a4c-6138df1fc81cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <825e2cbf-ecbf-49c3-891e-2ee73e45bac9n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 24 Mar 2022 11:05:44 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 74
 by: Mostowski Collapse - Thu, 24 Mar 2022 11:05 UTC

I wonder whether the existing flag iso could be used for
such purpose.

iso (bool, changeable)
https://www.swi-prolog.org/pldoc/man?section=flags

Currently it doesn’t have some effect on arithmetic.
What could go wrong?

It would then also have the semantic of some StrictMath,
not in the Java sense, but in the ISO core standard

sense. Or maybe there are other flags?

Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 12:01:38 UTC+1:
> Thats quite an amazing scale of failure by Logtalk Nonsense,
> given the fact that it promoted QuickCheck. Almost as cring
>
> as the failed Invasion of Ukraine by Russia. Unfortunately
> Europe gets now fucked up by US via NATO?
> Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:48:12 UTC+1:
> > Does it make a difference. Well you can check yourself:
> > So I made some additional tests, first Scryer Prolog v0.8.123:
> >
> > ?- X is round(0.5).
> > X = 1.
> > ?- X is round(-0.5).
> > X = 0.
> >
> > And then SWI-Prolog 8.5.8:
> >
> > ?- X is round(0.5).
> > X = 1.
> > ?- X is round(-0.5).
> > X = -1.
> > Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:45:21 UTC+1:
> > > But round is really a can of worms. Just out of curiousity I was
> > > checking out the ISO core standard, and it tells me:
> > >
> > > round(x) = floor(x+1/2)
> > >
> > > For example my definition of round function usually says,
> > > and what SWI-Prolog possibly implemented so far:
> > >
> > > round(x) = truncate(x + sign(x)*1/2)
> > >
> > > And not what the ISO core standard gives.
> > > Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:44:06 UTC+1:
> > > > Because the test is from here:
> > > >
> > > > real(1.0e+32).
> > > > test(lgt_unbounded_round_01, true(integer(N))) :-
> > > > real(Value),
> > > > N is round(Value).
> > > > https://github.com/LogtalkDotOrg/logtalk3/blob/master/tests/prolog/unbounded/tests.lgt
> > > >
> > > > But the test doesn't make any sense obviously,
> > > > only testing whether a result is integer, and not what
> > > > it is particularly.
> > > > Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:41:32 UTC+1:
> > > > > Ha Ha, Logtalk Nonsense is as real as a Pink Unicorn.
> > > > >
> > > > > If they would really have all these adapters and their
> > > > > test suite, they would have by long already detected this bug:
> > > > >
> > > > > round() result #1365
> > > > > https://github.com/mthom/scryer-prolog/issues/1365
> > > > >
> > > > > LoL

Re: Does a Prolog system use StrictMath or Math?

<bde0bdb6-aa5c-463b-8caf-b2f8e4629e9cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1218&group=comp.lang.prolog#1218

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:240e:b0:67d:7c27:242b with SMTP id d14-20020a05620a240e00b0067d7c27242bmr4288515qkn.293.1648150386269;
Thu, 24 Mar 2022 12:33:06 -0700 (PDT)
X-Received: by 2002:a25:8146:0:b0:629:2cb0:88ad with SMTP id
j6-20020a258146000000b006292cb088admr6046699ybm.217.1648150385927; Thu, 24
Mar 2022 12:33:05 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Thu, 24 Mar 2022 12:33:05 -0700 (PDT)
In-Reply-To: <825e2cbf-ecbf-49c3-891e-2ee73e45bac9n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com> <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
<b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com> <5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>
<898fd5de-3e22-463b-b0d4-80fd3e3b78ben@googlegroups.com> <2c0fd3f0-cab7-47f9-a5c2-b15c3e78f6d8n@googlegroups.com>
<ae7c33d4-d0e7-4f49-8a4c-6138df1fc81cn@googlegroups.com> <825e2cbf-ecbf-49c3-891e-2ee73e45bac9n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bde0bdb6-aa5c-463b-8caf-b2f8e4629e9cn@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 24 Mar 2022 19:33:06 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 97
 by: Mostowski Collapse - Thu, 24 Mar 2022 19:33 UTC

Now I found some useless information, I don’t know yet what to do with.
Java provides also the Python semantics via:

/**
* Returns the {@code double} value that is closest in value
* to the argument and is equal to a mathematical integer. If two
* {@code double} values that are mathematical integers are
* equally close to the value of the argument, the result is the
* integer value that is even.
*/
public static double rint(double a);

What I would be more interested is whether Python has a differerent
more Prolog like semantics round(). On the other hand the above piece of
information might be not that useless. A Prolog system could provide

two rounding functions. An evaluable function round/1 à la ISO core
standard, or some Prolog system specific divertimento like in SWI-Prolog,
rint/1 with the Python semantics. Both available in a Prolog system?

Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 12:05:44 UTC+1:
> I wonder whether the existing flag iso could be used for
> such purpose.
>
> iso (bool, changeable)
> https://www.swi-prolog.org/pldoc/man?section=flags
>
> Currently it doesn’t have some effect on arithmetic.
> What could go wrong?
>
> It would then also have the semantic of some StrictMath,
> not in the Java sense, but in the ISO core standard
>
> sense. Or maybe there are other flags?
> Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 12:01:38 UTC+1:
> > Thats quite an amazing scale of failure by Logtalk Nonsense,
> > given the fact that it promoted QuickCheck. Almost as cring
> >
> > as the failed Invasion of Ukraine by Russia. Unfortunately
> > Europe gets now fucked up by US via NATO?
> > Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:48:12 UTC+1:
> > > Does it make a difference. Well you can check yourself:
> > > So I made some additional tests, first Scryer Prolog v0.8.123:
> > >
> > > ?- X is round(0.5).
> > > X = 1.
> > > ?- X is round(-0.5).
> > > X = 0.
> > >
> > > And then SWI-Prolog 8.5.8:
> > >
> > > ?- X is round(0.5).
> > > X = 1.
> > > ?- X is round(-0.5).
> > > X = -1.
> > > Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:45:21 UTC+1:
> > > > But round is really a can of worms. Just out of curiousity I was
> > > > checking out the ISO core standard, and it tells me:
> > > >
> > > > round(x) = floor(x+1/2)
> > > >
> > > > For example my definition of round function usually says,
> > > > and what SWI-Prolog possibly implemented so far:
> > > >
> > > > round(x) = truncate(x + sign(x)*1/2)
> > > >
> > > > And not what the ISO core standard gives.
> > > > Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:44:06 UTC+1:
> > > > > Because the test is from here:
> > > > >
> > > > > real(1.0e+32).
> > > > > test(lgt_unbounded_round_01, true(integer(N))) :-
> > > > > real(Value),
> > > > > N is round(Value).
> > > > > https://github.com/LogtalkDotOrg/logtalk3/blob/master/tests/prolog/unbounded/tests.lgt
> > > > >
> > > > > But the test doesn't make any sense obviously,
> > > > > only testing whether a result is integer, and not what
> > > > > it is particularly.
> > > > > Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 11:41:32 UTC+1:
> > > > > > Ha Ha, Logtalk Nonsense is as real as a Pink Unicorn.
> > > > > >
> > > > > > If they would really have all these adapters and their
> > > > > > test suite, they would have by long already detected this bug:
> > > > > >
> > > > > > round() result #1365
> > > > > > https://github.com/mthom/scryer-prolog/issues/1365
> > > > > >
> > > > > > LoL

Re: Does a Prolog system use StrictMath or Math?

<80a8a717-6a69-470c-8733-300efb3b94c5n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1219&group=comp.lang.prolog#1219

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:5fd2:0:b0:2e1:b346:7505 with SMTP id k18-20020ac85fd2000000b002e1b3467505mr6124819qta.94.1648151918575;
Thu, 24 Mar 2022 12:58:38 -0700 (PDT)
X-Received: by 2002:a81:360d:0:b0:2e5:827a:98db with SMTP id
d13-20020a81360d000000b002e5827a98dbmr7139239ywa.49.1648151918363; Thu, 24
Mar 2022 12:58:38 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Thu, 24 Mar 2022 12:58:38 -0700 (PDT)
In-Reply-To: <bde0bdb6-aa5c-463b-8caf-b2f8e4629e9cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com> <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
<b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com> <5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>
<898fd5de-3e22-463b-b0d4-80fd3e3b78ben@googlegroups.com> <2c0fd3f0-cab7-47f9-a5c2-b15c3e78f6d8n@googlegroups.com>
<ae7c33d4-d0e7-4f49-8a4c-6138df1fc81cn@googlegroups.com> <825e2cbf-ecbf-49c3-891e-2ee73e45bac9n@googlegroups.com>
<bde0bdb6-aa5c-463b-8caf-b2f8e4629e9cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <80a8a717-6a69-470c-8733-300efb3b94c5n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 24 Mar 2022 19:58:38 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 38
 by: Mostowski Collapse - Thu, 24 Mar 2022 19:58 UTC

But the scope of StrictMath versus Math is usually only rounding
functions, trigonometry functions exponential functions i.e. round/2,
cos/2, exp/2, etc…

For control of arithmetic Java has the strictfp modifier, which would
affect (-)/2, (+)/3, (*)/3, etc… I guess, and might affect whether
64-bit can be temporarily turned in 80-bit floats:

Extended precision
Extended precision formats support a basic format by minimizing
roundoff and overflow errors in intermediate values of expressions
on the base format
https://en.wikipedia.org/wiki/Extended_precision

Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 20:33:07 UTC+1:
> Now I found some useless information, I don’t know yet what to do with.
> Java provides also the Python semantics via:
>
> /**
> * Returns the {@code double} value that is closest in value
> * to the argument and is equal to a mathematical integer. If two
> * {@code double} values that are mathematical integers are
> * equally close to the value of the argument, the result is the
> * integer value that is even.
> */
> public static double rint(double a);
>
> What I would be more interested is whether Python has a differerent
> more Prolog like semantics round(). On the other hand the above piece of
> information might be not that useless. A Prolog system could provide
>
> two rounding functions. An evaluable function round/1 à la ISO core
> standard, or some Prolog system specific divertimento like in SWI-Prolog,
> rint/1 with the Python semantics. Both available in a Prolog system?

Re: Does a Prolog system use StrictMath or Math?

<f11fcd19-333a-4b49-9ccd-e606bb79de1bn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1220&group=comp.lang.prolog#1220

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:4e46:0:b0:2e1:b933:ec06 with SMTP id e6-20020ac84e46000000b002e1b933ec06mr6177404qtw.684.1648151991819;
Thu, 24 Mar 2022 12:59:51 -0700 (PDT)
X-Received: by 2002:a25:ba0c:0:b0:61a:79a6:fd0 with SMTP id
t12-20020a25ba0c000000b0061a79a60fd0mr6310396ybg.45.1648151991604; Thu, 24
Mar 2022 12:59:51 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Thu, 24 Mar 2022 12:59:51 -0700 (PDT)
In-Reply-To: <80a8a717-6a69-470c-8733-300efb3b94c5n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com> <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
<b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com> <5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>
<898fd5de-3e22-463b-b0d4-80fd3e3b78ben@googlegroups.com> <2c0fd3f0-cab7-47f9-a5c2-b15c3e78f6d8n@googlegroups.com>
<ae7c33d4-d0e7-4f49-8a4c-6138df1fc81cn@googlegroups.com> <825e2cbf-ecbf-49c3-891e-2ee73e45bac9n@googlegroups.com>
<bde0bdb6-aa5c-463b-8caf-b2f8e4629e9cn@googlegroups.com> <80a8a717-6a69-470c-8733-300efb3b94c5n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f11fcd19-333a-4b49-9ccd-e606bb79de1bn@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 24 Mar 2022 19:59:51 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 52
 by: Mostowski Collapse - Thu, 24 Mar 2022 19:59 UTC

But now I am confused, I recently made the step to JDK 16. And now
I read “As of Java 17, using this keyword has no effect.” Does extended
precision not anymore exist, is basically dead?

It seems to be dead, since taking a time machine, back then, 80-bit
was cheap (because there was FPU) and 64-bit was expensive, and
now its not anymore the case (because on chip).

At least when I read here JEP 306 it seems so.
https://openjdk.java.net/jeps/306

Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 20:58:39 UTC+1:
> But the scope of StrictMath versus Math is usually only rounding
> functions, trigonometry functions exponential functions i.e. round/2,
> cos/2, exp/2, etc…
>
> For control of arithmetic Java has the strictfp modifier, which would
> affect (-)/2, (+)/3, (*)/3, etc… I guess, and might affect whether
> 64-bit can be temporarily turned in 80-bit floats:
>
> Extended precision
> Extended precision formats support a basic format by minimizing
> roundoff and overflow errors in intermediate values of expressions
> on the base format
> https://en.wikipedia.org/wiki/Extended_precision
> Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 20:33:07 UTC+1:
> > Now I found some useless information, I don’t know yet what to do with.
> > Java provides also the Python semantics via:
> >
> > /**
> > * Returns the {@code double} value that is closest in value
> > * to the argument and is equal to a mathematical integer. If two
> > * {@code double} values that are mathematical integers are
> > * equally close to the value of the argument, the result is the
> > * integer value that is even.
> > */
> > public static double rint(double a);
> >
> > What I would be more interested is whether Python has a differerent
> > more Prolog like semantics round(). On the other hand the above piece of
> > information might be not that useless. A Prolog system could provide
> >
> > two rounding functions. An evaluable function round/1 à la ISO core
> > standard, or some Prolog system specific divertimento like in SWI-Prolog,
> > rint/1 with the Python semantics. Both available in a Prolog system?

Re: Does a Prolog system use StrictMath or Math?

<27c6a83a-462c-431e-a3ae-b29e226665c8n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1221&group=comp.lang.prolog#1221

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:578b:0:b0:2e2:324a:7b6c with SMTP id v11-20020ac8578b000000b002e2324a7b6cmr6043806qta.267.1648152660198;
Thu, 24 Mar 2022 13:11:00 -0700 (PDT)
X-Received: by 2002:a25:c884:0:b0:633:7961:8a06 with SMTP id
y126-20020a25c884000000b0063379618a06mr6388427ybf.38.1648152659888; Thu, 24
Mar 2022 13:10:59 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Thu, 24 Mar 2022 13:10:59 -0700 (PDT)
In-Reply-To: <f11fcd19-333a-4b49-9ccd-e606bb79de1bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com> <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
<b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com> <5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>
<898fd5de-3e22-463b-b0d4-80fd3e3b78ben@googlegroups.com> <2c0fd3f0-cab7-47f9-a5c2-b15c3e78f6d8n@googlegroups.com>
<ae7c33d4-d0e7-4f49-8a4c-6138df1fc81cn@googlegroups.com> <825e2cbf-ecbf-49c3-891e-2ee73e45bac9n@googlegroups.com>
<bde0bdb6-aa5c-463b-8caf-b2f8e4629e9cn@googlegroups.com> <80a8a717-6a69-470c-8733-300efb3b94c5n@googlegroups.com>
<f11fcd19-333a-4b49-9ccd-e606bb79de1bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <27c6a83a-462c-431e-a3ae-b29e226665c8n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 24 Mar 2022 20:11:00 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 67
 by: Mostowski Collapse - Thu, 24 Mar 2022 20:10 UTC

And now for the chill effect, since extended precision is dead:

The Sixth Sense (1999) - "I see dead people."
https://www.youtube.com/watch?v=ZSNyiSetZ8Y

Mostowski Collapse schrieb am Montag, 21. März 2022 um 09:26:59 UTC+1:
> As soon as I get my head out of the Ukraine conflict,
> and start doing Prolog, my sixth sense of stepping into
> corner cases starts working again. Eh voilà while doing

Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 20:59:52 UTC+1:
> But now I am confused, I recently made the step to JDK 16. And now
> I read “As of Java 17, using this keyword has no effect.” Does extended
> precision not anymore exist, is basically dead?
>
> It seems to be dead, since taking a time machine, back then, 80-bit
> was cheap (because there was FPU) and 64-bit was expensive, and
> now its not anymore the case (because on chip).
>
> At least when I read here JEP 306 it seems so.
> https://openjdk.java.net/jeps/306
> Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 20:58:39 UTC+1:
> > But the scope of StrictMath versus Math is usually only rounding
> > functions, trigonometry functions exponential functions i.e. round/2,
> > cos/2, exp/2, etc…
> >
> > For control of arithmetic Java has the strictfp modifier, which would
> > affect (-)/2, (+)/3, (*)/3, etc… I guess, and might affect whether
> > 64-bit can be temporarily turned in 80-bit floats:
> >
> > Extended precision
> > Extended precision formats support a basic format by minimizing
> > roundoff and overflow errors in intermediate values of expressions
> > on the base format
> > https://en.wikipedia.org/wiki/Extended_precision
> > Mostowski Collapse schrieb am Donnerstag, 24. März 2022 um 20:33:07 UTC+1:
> > > Now I found some useless information, I don’t know yet what to do with.
> > > Java provides also the Python semantics via:
> > >
> > > /**
> > > * Returns the {@code double} value that is closest in value
> > > * to the argument and is equal to a mathematical integer. If two
> > > * {@code double} values that are mathematical integers are
> > > * equally close to the value of the argument, the result is the
> > > * integer value that is even.
> > > */
> > > public static double rint(double a);
> > >
> > > What I would be more interested is whether Python has a differerent
> > > more Prolog like semantics round(). On the other hand the above piece of
> > > information might be not that useless. A Prolog system could provide
> > >
> > > two rounding functions. An evaluable function round/1 à la ISO core
> > > standard, or some Prolog system specific divertimento like in SWI-Prolog,
> > > rint/1 with the Python semantics. Both available in a Prolog system?

Re: Does a Prolog system use StrictMath or Math?

<9705c2b4-5ba7-45c2-8b17-a1d27c565331n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1222&group=comp.lang.prolog#1222

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ad4:5be3:0:b0:441:2af0:6ea2 with SMTP id k3-20020ad45be3000000b004412af06ea2mr16998025qvc.116.1648390018507;
Sun, 27 Mar 2022 07:06:58 -0700 (PDT)
X-Received: by 2002:a81:78f:0:b0:2e5:bf12:5edc with SMTP id
137-20020a81078f000000b002e5bf125edcmr20732806ywh.433.1648390018353; Sun, 27
Mar 2022 07:06:58 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Sun, 27 Mar 2022 07:06:58 -0700 (PDT)
In-Reply-To: <27c6a83a-462c-431e-a3ae-b29e226665c8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com> <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
<b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com> <5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>
<898fd5de-3e22-463b-b0d4-80fd3e3b78ben@googlegroups.com> <2c0fd3f0-cab7-47f9-a5c2-b15c3e78f6d8n@googlegroups.com>
<ae7c33d4-d0e7-4f49-8a4c-6138df1fc81cn@googlegroups.com> <825e2cbf-ecbf-49c3-891e-2ee73e45bac9n@googlegroups.com>
<bde0bdb6-aa5c-463b-8caf-b2f8e4629e9cn@googlegroups.com> <80a8a717-6a69-470c-8733-300efb3b94c5n@googlegroups.com>
<f11fcd19-333a-4b49-9ccd-e606bb79de1bn@googlegroups.com> <27c6a83a-462c-431e-a3ae-b29e226665c8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9705c2b4-5ba7-45c2-8b17-a1d27c565331n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 27 Mar 2022 14:06:58 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 16
 by: Mostowski Collapse - Sun, 27 Mar 2022 14:06 UTC

Now I wonder whether I can implement my own
round/1 evaluable function in a platform that doesn't
provide the round/1 that I want to have.

Example of such a platform would be Python.
Python rather provides Math.rint() instead of
Math.round(). So can we implement round/1 on

our own. It seems so, when we have suitable
float parts. Looking at SWI-Prolog:

?- float_parts(0.4, M, _, E).
M = 0.8,
E = -1.

I think the above doesn't work. It returns the mantissa
as a float, so we would be running in circles.

Re: Does a Prolog system use StrictMath or Math?

<a11ab2c3-708e-4e7d-ab31-8287905d1e41n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1223&group=comp.lang.prolog#1223

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:24f:b0:2e1:d658:a595 with SMTP id c15-20020a05622a024f00b002e1d658a595mr17281861qtx.657.1648390110259;
Sun, 27 Mar 2022 07:08:30 -0700 (PDT)
X-Received: by 2002:a81:5c86:0:b0:2ea:6d45:fea6 with SMTP id
q128-20020a815c86000000b002ea6d45fea6mr287141ywb.421.1648390109957; Sun, 27
Mar 2022 07:08:29 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.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.prolog
Date: Sun, 27 Mar 2022 07:08:29 -0700 (PDT)
In-Reply-To: <9705c2b4-5ba7-45c2-8b17-a1d27c565331n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com> <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
<b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com> <5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>
<898fd5de-3e22-463b-b0d4-80fd3e3b78ben@googlegroups.com> <2c0fd3f0-cab7-47f9-a5c2-b15c3e78f6d8n@googlegroups.com>
<ae7c33d4-d0e7-4f49-8a4c-6138df1fc81cn@googlegroups.com> <825e2cbf-ecbf-49c3-891e-2ee73e45bac9n@googlegroups.com>
<bde0bdb6-aa5c-463b-8caf-b2f8e4629e9cn@googlegroups.com> <80a8a717-6a69-470c-8733-300efb3b94c5n@googlegroups.com>
<f11fcd19-333a-4b49-9ccd-e606bb79de1bn@googlegroups.com> <27c6a83a-462c-431e-a3ae-b29e226665c8n@googlegroups.com>
<9705c2b4-5ba7-45c2-8b17-a1d27c565331n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a11ab2c3-708e-4e7d-ab31-8287905d1e41n@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 27 Mar 2022 14:08:30 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 49
 by: Mostowski Collapse - Sun, 27 Mar 2022 14:08 UTC

Whats more promissing is this take from our
own Prolog system, formerly Jekejeke Prolog:

?- sys_float_mantissa(0.4, M).
M = 7205759403792794.
?- sys_float_exponent(0.4, E).
E = -54.

Now we can define our own round/1 evaluable function, inspired
how Math.round() from Java does it. This shows only the sunshine
case for round/1, when E and M are in a suitable range:

round2(X,Y) :-
sys_float_mantissa(X, M),
sys_float_exponent(X, E),
Y is ((M >> (-E-1)) + 1) >> 1.

?- round2(23.4, X).
X = 23.
?- round2(24.6, X).
X = 25.

And for the nextto numbers:

?- 0.49999999999999994 == 0.4999999999999999.
fail.
?- round2(0.49999999999999994, X).
X = 0.
?- round2(0.4999999999999999, X).
X = 0.

Mostowski Collapse schrieb am Sonntag, 27. März 2022 um 16:06:59 UTC+2:
> Now I wonder whether I can implement my own
> round/1 evaluable function in a platform that doesn't
> provide the round/1 that I want to have.
>
> Example of such a platform would be Python.
> Python rather provides Math.rint() instead of
> Math.round(). So can we implement round/1 on
>
> our own. It seems so, when we have suitable
> float parts. Looking at SWI-Prolog:
>
> ?- float_parts(0.4, M, _, E).
> M = 0.8,
> E = -1.
>
> I think the above doesn't work. It returns the mantissa
> as a float, so we would be running in circles.

Re: Does a Prolog system use StrictMath or Math?

<8f9c7f5b-6c83-43df-95fd-bf5745fafe6en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1224&group=comp.lang.prolog#1224

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:188e:b0:2e2:3c47:9cab with SMTP id v14-20020a05622a188e00b002e23c479cabmr16728670qtc.559.1648424032884;
Sun, 27 Mar 2022 16:33:52 -0700 (PDT)
X-Received: by 2002:a25:2497:0:b0:633:c1d0:e7bb with SMTP id
k145-20020a252497000000b00633c1d0e7bbmr20932313ybk.291.1648424032690; Sun, 27
Mar 2022 16:33:52 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.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.prolog
Date: Sun, 27 Mar 2022 16:33:52 -0700 (PDT)
In-Reply-To: <a11ab2c3-708e-4e7d-ab31-8287905d1e41n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <c75c846e-039c-48d5-a864-010a4ec02c60n@googlegroups.com>
<cd02d52f-e2ca-4b96-94f4-e2fe1ce86146n@googlegroups.com> <782e2e80-42fd-4644-b55e-cb85931aa161n@googlegroups.com>
<83b3e6c6-c741-4bc3-a726-b68a6054d654n@googlegroups.com> <09bca477-8ad9-4cbe-9f0f-416671b14921n@googlegroups.com>
<3517b461-e35f-4752-ae53-8b00b937c2d7n@googlegroups.com> <3734da4a-2b0e-4cb2-b6bc-e0ed1140a525n@googlegroups.com>
<b6f3b090-252d-43b0-b30d-a10506537b52n@googlegroups.com> <5aaf20c2-f75e-4dd8-95fb-1ed01d4c0489n@googlegroups.com>
<898fd5de-3e22-463b-b0d4-80fd3e3b78ben@googlegroups.com> <2c0fd3f0-cab7-47f9-a5c2-b15c3e78f6d8n@googlegroups.com>
<ae7c33d4-d0e7-4f49-8a4c-6138df1fc81cn@googlegroups.com> <825e2cbf-ecbf-49c3-891e-2ee73e45bac9n@googlegroups.com>
<bde0bdb6-aa5c-463b-8caf-b2f8e4629e9cn@googlegroups.com> <80a8a717-6a69-470c-8733-300efb3b94c5n@googlegroups.com>
<f11fcd19-333a-4b49-9ccd-e606bb79de1bn@googlegroups.com> <27c6a83a-462c-431e-a3ae-b29e226665c8n@googlegroups.com>
<9705c2b4-5ba7-45c2-8b17-a1d27c565331n@googlegroups.com> <a11ab2c3-708e-4e7d-ab31-8287905d1e41n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8f9c7f5b-6c83-43df-95fd-bf5745fafe6en@googlegroups.com>
Subject: Re: Does a Prolog system use StrictMath or Math?
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 27 Mar 2022 23:33:52 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 76
 by: Mostowski Collapse - Sun, 27 Mar 2022 23:33 UTC

Now getting a step closer to replace the Python builtin.
This one works also, for positive numbers:

round2(X,Y) :- Y is (truncate(2*X)+1)>>1.

I get:

?- round2(23.4, X).
X = 23.

?- round2(24.6, X).
X = 25.

?- round2(0.49999999999999994, X).
X = 0.

?- round2(0.4999999999999999, X).
X = 0.

It works because it only uses multiplication by 2 for floats,
which is exact, only increments the exponent, and it doesn’t
use some addition or subtraction for floats.

The addition happens when we already have an integer.

Mostowski Collapse schrieb am Sonntag, 27. März 2022 um 16:08:31 UTC+2:
> Whats more promissing is this take from our
> own Prolog system, formerly Jekejeke Prolog:
>
> ?- sys_float_mantissa(0.4, M).
> M = 7205759403792794.
> ?- sys_float_exponent(0.4, E).
> E = -54.
>
> Now we can define our own round/1 evaluable function, inspired
> how Math.round() from Java does it. This shows only the sunshine
> case for round/1, when E and M are in a suitable range:
>
> round2(X,Y) :-
> sys_float_mantissa(X, M),
> sys_float_exponent(X, E),
> Y is ((M >> (-E-1)) + 1) >> 1.
>
> ?- round2(23.4, X).
> X = 23.
> ?- round2(24.6, X).
> X = 25.
>
> And for the nextto numbers:
>
> ?- 0.49999999999999994 == 0.4999999999999999.
> fail.
> ?- round2(0.49999999999999994, X).
> X = 0.
> ?- round2(0.4999999999999999, X).
> X = 0.
> Mostowski Collapse schrieb am Sonntag, 27. März 2022 um 16:06:59 UTC+2:
> > Now I wonder whether I can implement my own
> > round/1 evaluable function in a platform that doesn't
> > provide the round/1 that I want to have.
> >
> > Example of such a platform would be Python.
> > Python rather provides Math.rint() instead of
> > Math.round(). So can we implement round/1 on
> >
> > our own. It seems so, when we have suitable
> > float parts. Looking at SWI-Prolog:
> >
> > ?- float_parts(0.4, M, _, E).
> > M = 0.8,
> > E = -1.
> >
> > I think the above doesn't work. It returns the mantissa
> > as a float, so we would be running in circles.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor