Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

!07/11 PDP a ni deppart m'I !pleH


devel / comp.lang.fortran / print '(E330.320)', huge(1.d0)

SubjectAuthor
* print '(E330.320)', huge(1.d0)Peter Klausler US
`* Re: print '(E330.320)', huge(1.d0)Steve Lionel
 `* Re: print '(E330.320)', huge(1.d0)Peter Klausler US
  `* Re: print '(E330.320)', huge(1.d0)Steve Lionel
   `* Re: print '(E330.320)', huge(1.d0)Peter Klausler US
    +* Re: print '(E330.320)', huge(1.d0)gah4
    |`* Re: print '(E330.320)', huge(1.d0)Peter Klausler US
    | +- Re: print '(E330.320)', huge(1.d0)gah4
    | `- Re: print '(E330.320)', huge(1.d0)CyrMag
    `* Re: print '(E330.320)', huge(1.d0)Ron Shepard
     +* Re: print '(E330.320)', huge(1.d0)Peter Klausler US
     |`- Re: print '(E330.320)', huge(1.d0)jfh
     `* Re: print '(E330.320)', huge(1.d0)gah4
      `* Re: print '(E330.320)', huge(1.d0)Jeff Ryman
       `- Re: print '(E330.320)', huge(1.d0)gah4

1
print '(E330.320)', huge(1.d0)

<07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:9a1:b0:56e:9089:a447 with SMTP id du1-20020a05621409a100b0056e9089a447mr7122704qvb.0.1679328433372;
Mon, 20 Mar 2023 09:07:13 -0700 (PDT)
X-Received: by 2002:a05:620a:c81:b0:743:6092:91b4 with SMTP id
q1-20020a05620a0c8100b00743609291b4mr9085734qki.14.1679328433038; Mon, 20 Mar
2023 09:07:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.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.fortran
Date: Mon, 20 Mar 2023 09:07:12 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=ZT-cAwoAAACx2tBPXm-WZoHIT8sjnGGy
NNTP-Posting-Host: 12.154.207.45
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
Subject: print '(E330.320)', huge(1.d0)
From: pklausler@nvidia.com (Peter Klausler US)
Injection-Date: Mon, 20 Mar 2023 16:07:13 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 32
 by: Peter Klausler US - Mon, 20 Mar 2023 16:07 UTC

.... produces distinct results from nearly each compiler that I tried:

0.17976931348623157081452742373170435679807056752584499659891747680315726078002853876058955863276687817154045895351438246423432132688946418276846754670353751698604991057655128207624549009038932894407586850845513394230458323690322294816580855933212334827479782620414472316873817718091929988125040402618412485836800000000000+309

***************************************************************************************************************************************************************************************************************************************************************

0.17976931348623157081452742373170435679807056752584499659891747680315726078002853876058955863276687817154045895351438246423432132688946418276846754670353751698604991057655128207624549009038932894407586850845513394230458323690322294816580855933212334827479782620414472316873817718091929988125040402618412485836800000000000+309

0.17976931348623157081452742373170435679807000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000+309

0.17976931348623157081452742373200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000+309

I think that the first and third outputs are correct. Can the others be said to conform?

Re: print '(E330.320)', huge(1.d0)

<k7rl0uF1qa6U1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: steve@seesignature.invalid (Steve Lionel)
Newsgroups: comp.lang.fortran
Subject: Re: print '(E330.320)', huge(1.d0)
Date: Mon, 20 Mar 2023 13:55:43 -0400
Lines: 44
Message-ID: <k7rl0uF1qa6U1@mid.individual.net>
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net jvrwU5fh9PsYXNVNDCK4BQuYnYtw4OQk4lTIfGkuFRcFyQP3Ti
Cancel-Lock: sha1:dM8Oi+O2kl/XwoRyVJj+x4LQmYg=
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
 by: Steve Lionel - Mon, 20 Mar 2023 17:55 UTC

On 3/20/2023 12:07 PM, Peter Klausler US wrote:
> ... produces distinct results from nearly each compiler that I tried:
>
> 0.17976931348623157081452742373170435679807056752584499659891747680315726078002853876058955863276687817154045895351438246423432132688946418276846754670353751698604991057655128207624549009038932894407586850845513394230458323690322294816580855933212334827479782620414472316873817718091929988125040402618412485836800000000000+309
>
> ***************************************************************************************************************************************************************************************************************************************************************
>
> 0.17976931348623157081452742373170435679807056752584499659891747680315726078002853876058955863276687817154045895351438246423432132688946418276846754670353751698604991057655128207624549009038932894407586850845513394230458323690322294816580855933212334827479782620414472316873817718091929988125040402618412485836800000000000+309
>
> 0.17976931348623157081452742373170435679807000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000+309
>
> 0.17976931348623157081452742373200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000+309
>
> I think that the first and third outputs are correct. Can the others be said to conform?

All of them conform. For the second, the values of 330 and 320 for w and
d exceed the compiler's limits. I assume this was Intel you tried, and
it produces the following warnings:
t.f90(1): warning #7557: Edit descriptor fields d and e must be less
than or equal to 255 - using 255.
print '(E330.320)', huge(1.d0)
---------^
t.f90(1): warning #7557: Edit descriptor fields d and e must be less
than or equal to 255 - using 255.
print '(E330.320)', huge(1.d0)
-------------^
t.f90(1): remark #8291: Recommended relationship between field width 'W'
and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'.
print '(E330.320)', huge(1.d0)

As for the others, I'd argue that all of these strings correspond to the
internal value. In general, all you need is three additional decimal
digits over the decimal precision of the kind to exactly specify a
particular internal value.
--
Steve Lionel
ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
Retired Intel Fortran developer/support
Email: firstname at firstnamelastname dot com
Twitter: @DoctorFortran
LinkedIn: https://www.linkedin.com/in/stevelionel
Blog: https://stevelionel.com/drfortran
WG5: https://wg5-fortran.org

Re: print '(E330.320)', huge(1.d0)

<c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a37:e104:0:b0:746:8df7:8672 with SMTP id c4-20020a37e104000000b007468df78672mr681196qkm.13.1679337613699;
Mon, 20 Mar 2023 11:40:13 -0700 (PDT)
X-Received: by 2002:ad4:4e21:0:b0:570:ed88:8a13 with SMTP id
dm1-20020ad44e21000000b00570ed888a13mr7246543qvb.6.1679337613502; Mon, 20 Mar
2023 11:40:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!diablo1.usenet.blueworldhosting.com!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.fortran
Date: Mon, 20 Mar 2023 11:40:13 -0700 (PDT)
In-Reply-To: <k7rl0uF1qa6U1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=ZT-cAwoAAACx2tBPXm-WZoHIT8sjnGGy
NNTP-Posting-Host: 12.154.207.45
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com> <k7rl0uF1qa6U1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
Subject: Re: print '(E330.320)', huge(1.d0)
From: pklausler@nvidia.com (Peter Klausler US)
Injection-Date: Mon, 20 Mar 2023 18:40:13 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2035
 by: Peter Klausler US - Mon, 20 Mar 2023 18:40 UTC

On Monday, March 20, 2023 at 10:55:47 AM UTC-7, Steve Lionel wrote:
> As for the others, I'd argue that all of these strings correspond to the
> internal value. In general, all you need is three additional decimal
> digits over the decimal precision of the kind to exactly specify a
> particular internal value.

I see that 13.7.2.3.3p4 defines "x1 x2 . . . xd are the d most significant digits of the internal value after rounding" and 13.7.2.3.8 describes the rounding process as a choice of representable values (decimal in the case of (non-EX) output). Any floating-point value that is an integer is exactly representable in decimal, given sufficient digits. But I can't find any text that permits an exact representable decimal result to be rounded to a number of decimal digits fewer that 'd'.

Re: print '(E330.320)', huge(1.d0)

<k7rsgrF1qa6U2@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: steve@seesignature.invalid (Steve Lionel)
Newsgroups: comp.lang.fortran
Subject: Re: print '(E330.320)', huge(1.d0)
Date: Mon, 20 Mar 2023 16:03:39 -0400
Lines: 47
Message-ID: <k7rsgrF1qa6U2@mid.individual.net>
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
<k7rl0uF1qa6U1@mid.individual.net>
<c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net 25C2nNMRdtf1BFuYwK6DcgJ8UYQBywx5/kLYlfXnx6UD2tLMMY
Cancel-Lock: sha1:mYe4Q3JYQvtKICaVCMumyy9wL2A=
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
 by: Steve Lionel - Mon, 20 Mar 2023 20:03 UTC

On 3/20/2023 2:40 PM, Peter Klausler US wrote:
> I see that 13.7.2.3.3p4 defines "x1 x2 . . . xd are the d most significant digits of the internal value after rounding" and 13.7.2.3.8 describes the rounding process as a choice of representable values (decimal in the case of (non-EX) output). Any floating-point value that is an integer is exactly representable in decimal, given sufficient digits. But I can't find any text that permits an exact representable decimal result to be rounded to a number of decimal digits fewer that 'd'.

Consider (ignore the line wrapping):

program test
implicit none
character(80) :: string
real(kind(0.D0)) :: x

string =
'0.179769313486231570814527423731704356798070567525844996598917476803157E+309'
read (string,'(E80.73)') x
write (*,'(Z16.16)') x

string =
'0.179769313486231570814527423731704356798070000000000000000000000000000E+309'
read (string,'(E80.73)') x
write (*,'(Z16.16)') x

string =
'0.179769313486231570814527423732000000000000000000000000000000000000000E+309'
read (string,'(E80.73)') x
write (*,'(Z16.16)') x

end

(This program isn't strict F2018, but the use of Z format for
non-integers is widely accepted.) When I build and run this I get:

7FEFFFFFFFFFFFFF
7FEFFFFFFFFFFFFF
7FEFFFFFFFFFFFFF

Who's to say one string is "more correct" than the other? Why do you
assume that huge(1.0d0) is exactly representable in decimal?

--
Steve Lionel
ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
Retired Intel Fortran developer/support
Email: firstname at firstnamelastname dot com
Twitter: @DoctorFortran
LinkedIn: https://www.linkedin.com/in/stevelionel
Blog: https://stevelionel.com/drfortran
WG5: https://wg5-fortran.org

Re: print '(E330.320)', huge(1.d0)

<cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:9a5:b0:56c:1865:feb with SMTP id du5-20020a05621409a500b0056c18650febmr63423qvb.3.1679345458952;
Mon, 20 Mar 2023 13:50:58 -0700 (PDT)
X-Received: by 2002:a05:622a:100a:b0:3e1:934d:ba1a with SMTP id
d10-20020a05622a100a00b003e1934dba1amr233179qte.3.1679345458765; Mon, 20 Mar
2023 13:50:58 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.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.fortran
Date: Mon, 20 Mar 2023 13:50:58 -0700 (PDT)
In-Reply-To: <k7rsgrF1qa6U2@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=ZT-cAwoAAACx2tBPXm-WZoHIT8sjnGGy
NNTP-Posting-Host: 12.154.207.45
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
<k7rl0uF1qa6U1@mid.individual.net> <c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
<k7rsgrF1qa6U2@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>
Subject: Re: print '(E330.320)', huge(1.d0)
From: pklausler@nvidia.com (Peter Klausler US)
Injection-Date: Mon, 20 Mar 2023 20:50:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1518
 by: Peter Klausler US - Mon, 20 Mar 2023 20:50 UTC

On Monday, March 20, 2023 at 1:03:44 PM UTC-7, Steve Lionel wrote:
> Why do you assume that huge(1.0d0) is exactly representable in decimal?

Because every finite binary floating-point number has an exact decimal value.

Re: print '(E330.320)', huge(1.d0)

<550e4f57-2763-41ae-8e9e-06d6261163ben@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:174c:b0:3bf:b9d9:6759 with SMTP id l12-20020a05622a174c00b003bfb9d96759mr271102qtk.8.1679347935782;
Mon, 20 Mar 2023 14:32:15 -0700 (PDT)
X-Received: by 2002:a05:622a:100a:b0:3bf:d520:1d59 with SMTP id
d10-20020a05622a100a00b003bfd5201d59mr266476qte.1.1679347935563; Mon, 20 Mar
2023 14:32:15 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.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.fortran
Date: Mon, 20 Mar 2023 14:32:15 -0700 (PDT)
In-Reply-To: <cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:d186:1c3c:7294:d4fe;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:d186:1c3c:7294:d4fe
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
<k7rl0uF1qa6U1@mid.individual.net> <c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
<k7rsgrF1qa6U2@mid.individual.net> <cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <550e4f57-2763-41ae-8e9e-06d6261163ben@googlegroups.com>
Subject: Re: print '(E330.320)', huge(1.d0)
From: gah4@u.washington.edu (gah4)
Injection-Date: Mon, 20 Mar 2023 21:32:15 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2182
 by: gah4 - Mon, 20 Mar 2023 21:32 UTC

On Monday, March 20, 2023 at 1:51:00 PM UTC-7, Peter Klausler US wrote:
> On Monday, March 20, 2023 at 1:03:44 PM UTC-7, Steve Lionel wrote:
> > Why do you assume that huge(1.0d0) is exactly representable in decimal?

> Because every finite binary floating-point number has an exact decimal value.

You mean if you assume all the bits to the right of the LSB are zero?

Reminds me that the C printf routine for %f format expands the width
give to fit the value. Some machines have a floating point format with
very large maximum value.

As for the bits to the right, the IBM 7030 has a switch on the panel to
select filling with 0's or 1's on post normalization.

The idea is to run the program both ways, and look for differences.

Re: print '(E330.320)', huge(1.d0)

<60260499-1d73-4f3a-9859-539e1475f01dn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a37:6588:0:b0:745:a78b:b32 with SMTP id z130-20020a376588000000b00745a78b0b32mr132762qkb.14.1679350354249;
Mon, 20 Mar 2023 15:12:34 -0700 (PDT)
X-Received: by 2002:a05:622a:1a28:b0:3de:4f0e:677d with SMTP id
f40-20020a05622a1a2800b003de4f0e677dmr314131qtb.7.1679350354107; Mon, 20 Mar
2023 15:12:34 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.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.fortran
Date: Mon, 20 Mar 2023 15:12:33 -0700 (PDT)
In-Reply-To: <550e4f57-2763-41ae-8e9e-06d6261163ben@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=ZT-cAwoAAACx2tBPXm-WZoHIT8sjnGGy
NNTP-Posting-Host: 12.154.207.45
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
<k7rl0uF1qa6U1@mid.individual.net> <c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
<k7rsgrF1qa6U2@mid.individual.net> <cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>
<550e4f57-2763-41ae-8e9e-06d6261163ben@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <60260499-1d73-4f3a-9859-539e1475f01dn@googlegroups.com>
Subject: Re: print '(E330.320)', huge(1.d0)
From: pklausler@nvidia.com (Peter Klausler US)
Injection-Date: Mon, 20 Mar 2023 22:12:34 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1980
 by: Peter Klausler US - Mon, 20 Mar 2023 22:12 UTC

On Monday, March 20, 2023 at 2:32:17 PM UTC-7, gah4 wrote:
> You mean if you assume all the bits to the right of the LSB are zero?

By "finite number" I meant the values aren't IEEE-754-ish infinities or NaNs. I did assume finite precision, though, and should have been explicit about that.

(But I think that the claim is true when there's a contiguous *infinite* sequence of one bits below the LSB, too.

Let x.= 0.11111111... in binary. Then 2x = 1.11111111..., so 2x-x = 1.0, so x+x-x = 1.0, so x = 1.0.)

Re: print '(E330.320)', huge(1.d0)

<7a490da5-6590-454b-9871-27b0326861d5n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:2103:b0:746:900c:22de with SMTP id l3-20020a05620a210300b00746900c22demr187501qkl.11.1679367254827;
Mon, 20 Mar 2023 19:54:14 -0700 (PDT)
X-Received: by 2002:a37:f613:0:b0:746:8b9d:a2e9 with SMTP id
y19-20020a37f613000000b007468b9da2e9mr255566qkj.11.1679367254662; Mon, 20 Mar
2023 19:54:14 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!diablo1.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.fortran
Date: Mon, 20 Mar 2023 19:54:14 -0700 (PDT)
In-Reply-To: <60260499-1d73-4f3a-9859-539e1475f01dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:d186:1c3c:7294:d4fe;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:d186:1c3c:7294:d4fe
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
<k7rl0uF1qa6U1@mid.individual.net> <c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
<k7rsgrF1qa6U2@mid.individual.net> <cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>
<550e4f57-2763-41ae-8e9e-06d6261163ben@googlegroups.com> <60260499-1d73-4f3a-9859-539e1475f01dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7a490da5-6590-454b-9871-27b0326861d5n@googlegroups.com>
Subject: Re: print '(E330.320)', huge(1.d0)
From: gah4@u.washington.edu (gah4)
Injection-Date: Tue, 21 Mar 2023 02:54:14 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2719
 by: gah4 - Tue, 21 Mar 2023 02:54 UTC

On Monday, March 20, 2023 at 3:12:36 PM UTC-7, Peter Klausler US wrote:
> On Monday, March 20, 2023 at 2:32:17 PM UTC-7, gah4 wrote:
> > You mean if you assume all the bits to the right of the LSB are zero?

> By "finite number" I meant the values aren't IEEE-754-ish infinities or NaNs.
> I did assume finite precision, though, and should have been explicit about that.
> (But I think that the claim is true when there's a contiguous *infinite* sequence of one bits below the LSB, too.
> Let x.= 0.11111111... in binary. Then 2x = 1.11111111..., so 2x-x = 1.0, so x+x-x = 1.0, so x = 1.0.)

Physics people are used to numbers having an uncertainty, and so floating
point is convenient. I then doesn't make sense to give any specific value
to digits past the end.

The OS/360 trigonometric routines will refuse calls with arguments
so large that there are no fraction bits.

Not so much later, I knew someone with a brand new HP-55 calculator.
If you so sin(9.999999999e99) (in degree mode) you get a non-zero value.
If you believe that is followed by zero digits, it is a multiple of 360.
Best not to do that.

Re: print '(E330.320)', huge(1.d0)

<XTFSL.394666$PXw7.127916@fx45.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx45.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:102.0)
Gecko/20100101 Thunderbird/102.8.0
Subject: Re: print '(E330.320)', huge(1.d0)
Content-Language: en-US
Newsgroups: comp.lang.fortran
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
<k7rl0uF1qa6U1@mid.individual.net>
<c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
<k7rsgrF1qa6U2@mid.individual.net>
<cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>
From: nospam@nowhere.org (Ron Shepard)
In-Reply-To: <cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 12
Message-ID: <XTFSL.394666$PXw7.127916@fx45.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Wed, 22 Mar 2023 11:19:03 -0500
X-Received-Bytes: 1577
 by: Ron Shepard - Wed, 22 Mar 2023 16:19 UTC

On 3/20/23 3:50 PM, Peter Klausler US wrote:
> On Monday, March 20, 2023 at 1:03:44 PM UTC-7, Steve Lionel wrote:
>> Why do you assume that huge(1.0d0) is exactly representable in decimal?
>
> Because every finite binary floating-point number has an exact decimal value.

Also, every floating point number larger than 1/epsilon has a
mathematical integer value (which of course cannot usually be
represented as a fortran integer). The ones with large exponents have
lots of trailing zeros.

$.02 -Ron Shepard

Re: print '(E330.320)', huge(1.d0)

<9cc2eaea-7ec2-4ced-8ad5-b66fd8a1d21bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a37:4444:0:b0:742:72c6:a140 with SMTP id r65-20020a374444000000b0074272c6a140mr985013qka.7.1679512742001;
Wed, 22 Mar 2023 12:19:02 -0700 (PDT)
X-Received: by 2002:ac8:5f0b:0:b0:3bf:b9d9:675f with SMTP id
x11-20020ac85f0b000000b003bfb9d9675fmr1902133qta.10.1679512741849; Wed, 22
Mar 2023 12:19:01 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.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.fortran
Date: Wed, 22 Mar 2023 12:19:01 -0700 (PDT)
In-Reply-To: <XTFSL.394666$PXw7.127916@fx45.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=ZT-cAwoAAACx2tBPXm-WZoHIT8sjnGGy
NNTP-Posting-Host: 12.154.207.45
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
<k7rl0uF1qa6U1@mid.individual.net> <c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
<k7rsgrF1qa6U2@mid.individual.net> <cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>
<XTFSL.394666$PXw7.127916@fx45.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9cc2eaea-7ec2-4ced-8ad5-b66fd8a1d21bn@googlegroups.com>
Subject: Re: print '(E330.320)', huge(1.d0)
From: pklausler@nvidia.com (Peter Klausler US)
Injection-Date: Wed, 22 Mar 2023 19:19:01 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2730
 by: Peter Klausler US - Wed, 22 Mar 2023 19:19 UTC

On Wednesday, March 22, 2023 at 9:19:07 AM UTC-7, Ron Shepard wrote:
> On 3/20/23 3:50 PM, Peter Klausler US wrote:
> > On Monday, March 20, 2023 at 1:03:44 PM UTC-7, Steve Lionel wrote:
> >> Why do you assume that huge(1.0d0) is exactly representable in decimal?
> >
> > Because every finite binary floating-point number has an exact decimal value.
> Also, every floating point number larger than 1/epsilon has a
> mathematical integer value (which of course cannot usually be
> represented as a fortran integer). The ones with large exponents have
> lots of trailing zeros.
>
> $.02 -Ron Shepard

That's true, and it does apply to huge(1d0), but the question really applies to all non-NaN non-infinite floating-point values with a radix that is a power of two and a finite number of mantissa bits. (And the proof is trivial that any positive or negative finite power of two has a finite exact decimal representation, and any sum of finite decimals will also be finite.) So I'm still not clear how some of those outputs above can qualify as conforming decimal representations for a specific binary FP number that -- like any binary floating-point non-NaN non-infinite value -- has only one exact decimal representation (modulo leading or trailing zeroes).

Re: print '(E330.320)', huge(1.d0)

<c3bdc7bf-6b43-4de9-9bc1-4bc8b54c9482n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:1983:b0:3db:cd1b:e227 with SMTP id u3-20020a05622a198300b003dbcd1be227mr1405334qtc.6.1679516512003;
Wed, 22 Mar 2023 13:21:52 -0700 (PDT)
X-Received: by 2002:ac8:5906:0:b0:3de:f192:600d with SMTP id
6-20020ac85906000000b003def192600dmr1719793qty.2.1679516511804; Wed, 22 Mar
2023 13:21:51 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.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.fortran
Date: Wed, 22 Mar 2023 13:21:51 -0700 (PDT)
In-Reply-To: <XTFSL.394666$PXw7.127916@fx45.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:bca2:1346:112b:472f;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:bca2:1346:112b:472f
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
<k7rl0uF1qa6U1@mid.individual.net> <c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
<k7rsgrF1qa6U2@mid.individual.net> <cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>
<XTFSL.394666$PXw7.127916@fx45.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c3bdc7bf-6b43-4de9-9bc1-4bc8b54c9482n@googlegroups.com>
Subject: Re: print '(E330.320)', huge(1.d0)
From: gah4@u.washington.edu (gah4)
Injection-Date: Wed, 22 Mar 2023 20:21:51 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3062
 by: gah4 - Wed, 22 Mar 2023 20:21 UTC

On Wednesday, March 22, 2023 at 9:19:07 AM UTC-7, Ron Shepard wrote:
> On 3/20/23 3:50 PM, Peter Klausler US wrote:
> > On Monday, March 20, 2023 at 1:03:44 PM UTC-7, Steve Lionel wrote:
> >> Why do you assume that huge(1.0d0) is exactly representable in decimal?

> > Because every finite binary floating-point number has an exact decimal value.

> Also, every floating point number larger than 1/epsilon has a
> mathematical integer value (which of course cannot usually be
> represented as a fortran integer). The ones with large exponents have
> lots of trailing zeros.
But why do you believe they are trailing zeros?

I was in college not long after pocket scientific calculators were affordable
for college students. We liked to write down answers to numeric problems
to 10 digits. Our TAs would write SIGFIGs over our answers, and usually
take off points.

We learned fast.

Answers have a finite, and usually small, number of significant digits.
We have no idea, and no expectation that we should have any idea,
about any following digits.

Maybe we assume that they are zeros, as it is too much work to assume
anything else.

For a fun story about what you can, and can't say, about things that
are not measured, you might read this one:

https://www.sciencenews.org/wp-content/uploads/2010/11/baseball.pdf

You might be surprised about some assumptions that aren't true.

(Most of the time we were supposed to write algebraic answers to
problems, so the actual problem of digits didn't come up all that often.)

Re: print '(E330.320)', huge(1.d0)

<f099d20f-b1fc-4ad5-90f5-f83ce9012ac8n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a37:688a:0:b0:746:96c2:e458 with SMTP id d132-20020a37688a000000b0074696c2e458mr737791qkc.4.1679519274047;
Wed, 22 Mar 2023 14:07:54 -0700 (PDT)
X-Received: by 2002:ac8:7e8d:0:b0:3bf:d313:40e with SMTP id
w13-20020ac87e8d000000b003bfd313040emr2012860qtj.13.1679519273798; Wed, 22
Mar 2023 14:07:53 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.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.fortran
Date: Wed, 22 Mar 2023 14:07:53 -0700 (PDT)
In-Reply-To: <c3bdc7bf-6b43-4de9-9bc1-4bc8b54c9482n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=50.20.125.142; posting-account=5z--qAoAAACnug7j_OOF1c_Rr7Nr64Gy
NNTP-Posting-Host: 50.20.125.142
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
<k7rl0uF1qa6U1@mid.individual.net> <c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
<k7rsgrF1qa6U2@mid.individual.net> <cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>
<XTFSL.394666$PXw7.127916@fx45.iad> <c3bdc7bf-6b43-4de9-9bc1-4bc8b54c9482n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f099d20f-b1fc-4ad5-90f5-f83ce9012ac8n@googlegroups.com>
Subject: Re: print '(E330.320)', huge(1.d0)
From: rymanjc@outlook.com (Jeff Ryman)
Injection-Date: Wed, 22 Mar 2023 21:07:54 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3727
 by: Jeff Ryman - Wed, 22 Mar 2023 21:07 UTC

On Wednesday, March 22, 2023 at 1:21:53 PM UTC-7, gah4 wrote:
> On Wednesday, March 22, 2023 at 9:19:07 AM UTC-7, Ron Shepard wrote:
> > On 3/20/23 3:50 PM, Peter Klausler US wrote:
> > > On Monday, March 20, 2023 at 1:03:44 PM UTC-7, Steve Lionel wrote:
> > >> Why do you assume that huge(1.0d0) is exactly representable in decimal?
>
> > > Because every finite binary floating-point number has an exact decimal value.
>
> > Also, every floating point number larger than 1/epsilon has a
> > mathematical integer value (which of course cannot usually be
> > represented as a fortran integer). The ones with large exponents have
> > lots of trailing zeros.
> But why do you believe they are trailing zeros?
>
> I was in college not long after pocket scientific calculators were affordable
> for college students. We liked to write down answers to numeric problems
> to 10 digits. Our TAs would write SIGFIGs over our answers, and usually
> take off points.
>
> We learned fast.
>
> Answers have a finite, and usually small, number of significant digits.
> We have no idea, and no expectation that we should have any idea,
> about any following digits.
>
> Maybe we assume that they are zeros, as it is too much work to assume
> anything else.
>
> For a fun story about what you can, and can't say, about things that
> are not measured, you might read this one:
>
> https://www.sciencenews.org/wp-content/uploads/2010/11/baseball.pdf
>
> You might be surprised about some assumptions that aren't true.
>
> (Most of the time we were supposed to write algebraic answers to
> problems, so the actual problem of digits didn't come up all that often.)

I took an atomic physics class from a professor who didn't want to teach, so he
made it as easy as possible on himself. Each exam had 10 questions worth 10
points each. If you got the same answer to a question as the professor, given
to three and only three significant figures, using a slide rule, you got 10 points.
If not, you got zero points. I learned little, got a C for the class, and was just
happy to be done with it.

Re: print '(E330.320)', huge(1.d0)

<68e4d580-a3fa-4cfa-9b01-3fee22bc433en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:170e:b0:3e1:5755:7bbf with SMTP id h14-20020a05622a170e00b003e157557bbfmr1875537qtk.5.1679521516477;
Wed, 22 Mar 2023 14:45:16 -0700 (PDT)
X-Received: by 2002:ac8:7e8d:0:b0:3bf:c1f3:84bc with SMTP id
w13-20020ac87e8d000000b003bfc1f384bcmr1850900qtj.11.1679521516323; Wed, 22
Mar 2023 14:45:16 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.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.fortran
Date: Wed, 22 Mar 2023 14:45:16 -0700 (PDT)
In-Reply-To: <f099d20f-b1fc-4ad5-90f5-f83ce9012ac8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:bca2:1346:112b:472f;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:bca2:1346:112b:472f
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
<k7rl0uF1qa6U1@mid.individual.net> <c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
<k7rsgrF1qa6U2@mid.individual.net> <cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>
<XTFSL.394666$PXw7.127916@fx45.iad> <c3bdc7bf-6b43-4de9-9bc1-4bc8b54c9482n@googlegroups.com>
<f099d20f-b1fc-4ad5-90f5-f83ce9012ac8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <68e4d580-a3fa-4cfa-9b01-3fee22bc433en@googlegroups.com>
Subject: Re: print '(E330.320)', huge(1.d0)
From: gah4@u.washington.edu (gah4)
Injection-Date: Wed, 22 Mar 2023 21:45:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2729
 by: gah4 - Wed, 22 Mar 2023 21:45 UTC

On Wednesday, March 22, 2023 at 2:07:56 PM UTC-7, Jeff Ryman wrote:

(snip)

> I took an atomic physics class from a professor who didn't want to teach, so he
> made it as easy as possible on himself. Each exam had 10 questions worth 10
> points each. If you got the same answer to a question as the professor, given
> to three and only three significant figures, using a slide rule, you got 10 points.
> If not, you got zero points. I learned little, got a C for the class, and was just
> happy to be done with it.

I had a thermodynamics class, where it was explained that most classes
have exams with easy and hard question, where hard questions are worth
more points. His would have easy and hard questions all worth the same
number of points.

Hard questions having more points compresses the grade scale.

I do remember, though, one question where the sort-of obvious
answer was zero, but just in case I worked on it some more.
I didn't get to finish, but the answer was zero.

Now, since you are supposed to show work, I don't know if I would
have gotten the points just for writing 0, though.

Re: print '(E330.320)', huge(1.d0)

<be9a3b76-c7ac-4793-82ac-761b5dde9cean@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:b:b0:3da:d56c:8f50 with SMTP id x11-20020a05622a000b00b003dad56c8f50mr1950304qtw.0.1679523776614;
Wed, 22 Mar 2023 15:22:56 -0700 (PDT)
X-Received: by 2002:ae9:eb88:0:b0:72b:25b4:565a with SMTP id
b130-20020ae9eb88000000b0072b25b4565amr995438qkg.0.1679523776374; Wed, 22 Mar
2023 15:22:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.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.fortran
Date: Wed, 22 Mar 2023 15:22:56 -0700 (PDT)
In-Reply-To: <9cc2eaea-7ec2-4ced-8ad5-b66fd8a1d21bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=115.189.96.247; posting-account=KnYfEgoAAAD1tUJTvdAUZ3XojNa5tezZ
NNTP-Posting-Host: 115.189.96.247
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
<k7rl0uF1qa6U1@mid.individual.net> <c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
<k7rsgrF1qa6U2@mid.individual.net> <cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>
<XTFSL.394666$PXw7.127916@fx45.iad> <9cc2eaea-7ec2-4ced-8ad5-b66fd8a1d21bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <be9a3b76-c7ac-4793-82ac-761b5dde9cean@googlegroups.com>
Subject: Re: print '(E330.320)', huge(1.d0)
From: harperjf2@gmail.com (jfh)
Injection-Date: Wed, 22 Mar 2023 22:22:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3918
 by: jfh - Wed, 22 Mar 2023 22:22 UTC

On Thursday, March 23, 2023 at 8:19:03 AM UTC+13, Peter Klausler US wrote:
> On Wednesday, March 22, 2023 at 9:19:07 AM UTC-7, Ron Shepard wrote:
> > On 3/20/23 3:50 PM, Peter Klausler US wrote:
> > > On Monday, March 20, 2023 at 1:03:44 PM UTC-7, Steve Lionel wrote:
> > >> Why do you assume that huge(1.0d0) is exactly representable in decimal?
> > >
> > > Because every finite binary floating-point number has an exact decimal value.
> > Also, every floating point number larger than 1/epsilon has a
> > mathematical integer value (which of course cannot usually be
> > represented as a fortran integer). The ones with large exponents have
> > lots of trailing zeros.
> >
> > $.02 -Ron Shepard
> That's true, and it does apply to huge(1d0), but the question really applies to all non-NaN non-infinite floating-point values with a radix that is a power of two and a finite number of mantissa bits. (And the proof is trivial that any positive or negative finite power of two has a finite exact decimal representation, and any sum of finite decimals will also be finite.) So I'm still not clear how some of those outputs above can qualify as conforming decimal representations for a specific binary FP number that -- like any binary floating-point non-NaN non-infinite value -- has only one exact decimal representation (modulo leading or trailing zeroes).

Even if you don't ask for vast numbers of digits, differnt compilers can give very different results with huge. I believe the program below is standard-conforming and so is what gfortran and ifort do with it. Finding the reason for the difference is an instructive lesson in floating-point arithmetic..

program bigtest
character bigch*32, errmsg*80
integer ios
real(kind(1d0)):: x = huge(x), y = huge(x)
write(bigch,*) x
write(*,*) bigch
read(bigch,*,iostat=ios,iomsg=errmsg) x
if(ios/=0) write(*,*) errmsg
write(bigch,"(ES27.19E3)") y
write(*,*) bigch
read(bigch,"(ES27.19E3)",iostat=ios,iomsg=errmsg) y
if(ios/=0) write(*,*) trim(errmsg)
end program bigtest

gfortran output:
1.7976931348623157E+308
1.7976931348623157081E+308
ifort output:

1.797693134862316E+308
input conversion error, unit -5, file Internal List-Directed Read

1.7976931348623157081E+308

Re: print '(E330.320)', huge(1.d0)

<68cad305-ca45-41df-ad41-cef5c66e7598n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:5906:0:b0:3de:f192:600d with SMTP id 6-20020ac85906000000b003def192600dmr2117481qty.2.1679551482832;
Wed, 22 Mar 2023 23:04:42 -0700 (PDT)
X-Received: by 2002:a05:620a:806:b0:71f:b908:7b83 with SMTP id
s6-20020a05620a080600b0071fb9087b83mr1183593qks.15.1679551482542; Wed, 22 Mar
2023 23:04:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.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.fortran
Date: Wed, 22 Mar 2023 23:04:42 -0700 (PDT)
In-Reply-To: <60260499-1d73-4f3a-9859-539e1475f01dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=76.142.113.87; posting-account=YGTUIQoAAAAFR372MRGEUx-D9N1L7CrN
NNTP-Posting-Host: 76.142.113.87
References: <07bed4a1-b7ab-4906-a6bd-44af1b576b8en@googlegroups.com>
<k7rl0uF1qa6U1@mid.individual.net> <c97d0705-8247-4dd1-9bfd-e6617580f8a2n@googlegroups.com>
<k7rsgrF1qa6U2@mid.individual.net> <cdb483a4-18e0-4643-b80a-64cebfd14e36n@googlegroups.com>
<550e4f57-2763-41ae-8e9e-06d6261163ben@googlegroups.com> <60260499-1d73-4f3a-9859-539e1475f01dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <68cad305-ca45-41df-ad41-cef5c66e7598n@googlegroups.com>
Subject: Re: print '(E330.320)', huge(1.d0)
From: cyrmag7@gmail.com (CyrMag)
Injection-Date: Thu, 23 Mar 2023 06:04:42 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2137
 by: CyrMag - Thu, 23 Mar 2023 06:04 UTC

On Monday, March 20, 2023 at 5:12:36 PM UTC-5, Peter Klausler US wrote:
....
> (But I think that the claim is true when there's a contiguous *infinite* sequence of one bits below the LSB, too.
>
> Let x.= 0.11111111... in binary. Then 2x = 1.11111111..., so 2x-x = 1.0, so x+x-x = 1.0, so x = 1.0.)

That does not quite work that way with a finite representation (e.g. 32-bit IEEE real).

program hello
equivalence (iu,u)
data iu/Z'3FFFFFFF'/
x = u/2 ! 0.111.... in binary
y = 2*x ! 1.111.... in binary
z = y - x ! is this exactly 1 ?
print *, x, y, z
end program

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor