Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Lisp Users: Due to the holiday next Monday, there will be no garbage collection.


devel / comp.lang.ada / Oddity with function returning image of fixed point type

SubjectAuthor
* Oddity with function returning image of fixed point typeJesper Quorning
`* Re: Oddity with function returning image of fixed point typeStephen Leake
 `* Re: Oddity with function returning image of fixed point typeDmitry A. Kazakov
  `- Re: Oddity with function returning image of fixed point typeJesper Quorning

1
Oddity with function returning image of fixed point type

<be3b685d-faf2-4d30-a1d5-036381edb3b3n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:7761:: with SMTP id h1mr2266993qtu.272.1630578345547;
Thu, 02 Sep 2021 03:25:45 -0700 (PDT)
X-Received: by 2002:a25:afcd:: with SMTP id d13mr3359595ybj.504.1630578345330;
Thu, 02 Sep 2021 03:25:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!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.ada
Date: Thu, 2 Sep 2021 03:25:45 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=194.255.97.108; posting-account=hMbstgoAAAAIa4kxFYtvUVUHbE1RcZzT
NNTP-Posting-Host: 194.255.97.108
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <be3b685d-faf2-4d30-a1d5-036381edb3b3n@googlegroups.com>
Subject: Oddity with function returning image of fixed point type
From: jesper.q...@gmail.com (Jesper Quorning)
Injection-Date: Thu, 02 Sep 2021 10:25:45 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 48
 by: Jesper Quorning - Thu, 2 Sep 2021 10:25 UTC

Is something odd going on here?
I did not expect Image_Odd1/2 to return floating point images.

with Ada.Text_Io; use Ada.Text_Io;

procedure Fpt_Last is

type Fpt is delta 0.01 digits 4;

Image_Last : constant String := Fpt'Image (Fpt'Last);

function Image_Ok return String is
begin
return Fpt'Last'Image;
-- return Fpt'Image (Fpt'Last); -- Also ok
end Image_Ok;

Last : constant Fpt := Fpt'Last;

function Image_Odd_1 return String is (Fpt'Last'Img);
function Image_Odd_2 return String is (Fpt'Last'Image);
function Image_Ok_2 return String is (Fpt'Image (FPT'Last));
function Image_Ok_3 return String is (Last'Image);

begin
Put_Line ("Image_Last : " & Image_Last);
Put_Line ("Image_Ok : " & Image_Ok);
Put_Line ("Image_Odd_1 : " & Image_Odd_1);
Put_Line ("Image_Odd_2 : " & Image_Odd_2);
Put_Line ("Image_Ok_2 : " & Image_Ok_2);
Put_Line ("Image_Ok_3 : " & Image_Ok_3);
end Fpt_Last;

Output:

Image_Last : 99.99
Image_Ok : 99.99
Image_Odd_1 : 9.99900000000000000E+01
Image_Odd_2 : 9.99900000000000000E+01
Image_Ok_2 : 99.99
Image_Ok_3 : 99.99

Compiled with gnatmake version 10.3.0 or CE 2020 on macOS 10.13.6.

/Jesper

Re: Oddity with function returning image of fixed point type

<86ilzi29dc.fsf@stephe-leake.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!9CzwYWWlKVx8RMZd/VcwFg.user.46.165.242.75.POSTED!not-for-mail
From: stephen_...@stephe-leake.org (Stephen Leake)
Newsgroups: comp.lang.ada
Subject: Re: Oddity with function returning image of fixed point type
Date: Thu, 02 Sep 2021 10:08:31 -0700
Organization: Aioe.org NNTP Server
Message-ID: <86ilzi29dc.fsf@stephe-leake.org>
References: <be3b685d-faf2-4d30-a1d5-036381edb3b3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: gioia.aioe.org; logging-data="36259"; posting-host="9CzwYWWlKVx8RMZd/VcwFg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt)
X-Notice: Filtered by postfilter v. 0.9.2
Cancel-Lock: sha1:rczs73gudbWAkcSB82RHG40gzTQ=
 by: Stephen Leake - Thu, 2 Sep 2021 17:08 UTC

Jesper Quorning <jesper.quorning@gmail.com> writes:

> Is something odd going on here?
> I did not expect Image_Odd1/2 to return floating point images.

Right, this looks like a compiler bug. LRM 3.5(13):

S'Last
S'Last denotes the upper bound of the range of S. The
value of this attribute is of the type of S.

But this is acting like Fpt'Last is universal_real.

--
-- Stephe

Re: Oddity with function returning image of fixed point type

<sgr1s9$1njk$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!x6YkKUCkj2qHLwbKnVEeag.user.46.165.242.91.POSTED!not-for-mail
From: mail...@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Oddity with function returning image of fixed point type
Date: Thu, 2 Sep 2021 19:32:57 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sgr1s9$1njk$1@gioia.aioe.org>
References: <be3b685d-faf2-4d30-a1d5-036381edb3b3n@googlegroups.com>
<86ilzi29dc.fsf@stephe-leake.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="56948"; posting-host="x6YkKUCkj2qHLwbKnVEeag.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dmitry A. Kazakov - Thu, 2 Sep 2021 17:32 UTC

On 2021-09-02 19:08, Stephen Leake wrote:
> Jesper Quorning <jesper.quorning@gmail.com> writes:
>
>> Is something odd going on here?
>> I did not expect Image_Odd1/2 to return floating point images.
>
> Right, this looks like a compiler bug. LRM 3.5(13):
>
> S'Last
> S'Last denotes the upper bound of the range of S. The
> value of this attribute is of the type of S.
>
> But this is acting like Fpt'Last is universal_real.

No, it is this:

LRM 4.10 (40/5)

"X'Image denotes the result of calling function S'Image with Arg being
X, where S is the nominal subtype of X."

The question is what is the nominal subtype of Fpt'Last.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Oddity with function returning image of fixed point type

<549e09ab-5456-407e-8e78-9d7772a4e561n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a0c:e104:: with SMTP id w4mr920728qvk.28.1630625045782;
Thu, 02 Sep 2021 16:24:05 -0700 (PDT)
X-Received: by 2002:a25:a4c6:: with SMTP id g64mr1135084ybi.173.1630625045636;
Thu, 02 Sep 2021 16:24: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.ada
Date: Thu, 2 Sep 2021 16:24:05 -0700 (PDT)
In-Reply-To: <sgr1s9$1njk$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=194.255.97.108; posting-account=hMbstgoAAAAIa4kxFYtvUVUHbE1RcZzT
NNTP-Posting-Host: 194.255.97.108
References: <be3b685d-faf2-4d30-a1d5-036381edb3b3n@googlegroups.com>
<86ilzi29dc.fsf@stephe-leake.org> <sgr1s9$1njk$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <549e09ab-5456-407e-8e78-9d7772a4e561n@googlegroups.com>
Subject: Re: Oddity with function returning image of fixed point type
From: jesper.q...@gmail.com (Jesper Quorning)
Injection-Date: Thu, 02 Sep 2021 23:24:05 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 33
 by: Jesper Quorning - Thu, 2 Sep 2021 23:24 UTC

torsdag den 2. september 2021 kl. 19.33.00 UTC+2 skrev Dmitry A. Kazakov:
> On 2021-09-02 19:08, Stephen Leake wrote:
> > Jesper Quorning <jesper....@gmail.com> writes:
> >
> >> Is something odd going on here?
> >> I did not expect Image_Odd1/2 to return floating point images.
> >
> > Right, this looks like a compiler bug. LRM 3.5(13):
> >
> > S'Last
> > S'Last denotes the upper bound of the range of S. The
> > value of this attribute is of the type of S.
> >
> > But this is acting like Fpt'Last is universal_real.

> No, it is this:
>
> LRM 4.10 (40/5)
Had to go back to Ada 83 LRM to find a chapter 4.10.

> "X'Image denotes the result of calling function S'Image with Arg being
> X, where S is the nominal subtype of X."
LRM 3.5 (35-36) says about the same.

> The question is what is the nominal subtype of Fpt'Last.

Well Image_Ok and Image_Odd_2 should both return Fpt'Last'Image so one of them must be bad.

Found LRM 3.5 (27.7/2) describing the image of a fixed point type.

Thanks for your responses. I will report the issue.

/Jesper

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor