Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

C'est magnifique, mais ce n'est pas l'Informatique. -- Bosquet [on seeing the IBM 4341]


devel / comp.lang.fortran / problem with NINT() and DOUBLEPRECISION input values

SubjectAuthor
* problem with NINT() and DOUBLEPRECISION input valuesJohn
+- Re: problem with NINT() and DOUBLEPRECISION input valuesSteven G. Kargl
+- Re: problem with NINT() and DOUBLEPRECISION input valuesRobert Corbett
`* Re: problem with NINT() and DOUBLEPRECISION input valuesgah4
 `* Re: problem with NINT() and DOUBLEPRECISION input valuesSteven G. Kargl
  `* Re: problem with NINT() and DOUBLEPRECISION input valuesgah4
   `* Re: problem with NINT() and DOUBLEPRECISION input valuesJohn
    `* Re: problem with NINT() and DOUBLEPRECISION input valuesSteven G. Kargl
     `- Re: problem with NINT() and DOUBLEPRECISION input valuesJohn

1
problem with NINT() and DOUBLEPRECISION input values

<20eed3bf-a3db-4841-90ff-8cfb716a272dn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ae9:c118:0:b0:6ee:cf34:6325 with SMTP id z24-20020ae9c118000000b006eecf346325mr19559141qki.459.1668604182066;
Wed, 16 Nov 2022 05:09:42 -0800 (PST)
X-Received: by 2002:a05:620a:211d:b0:6fa:182:f2d7 with SMTP id
l29-20020a05620a211d00b006fa0182f2d7mr18633541qkl.360.1668604181864; Wed, 16
Nov 2022 05:09:41 -0800 (PST)
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.fortran
Date: Wed, 16 Nov 2022 05:09:41 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:98c7:e9df:746d:4f1a;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:98c7:e9df:746d:4f1a
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <20eed3bf-a3db-4841-90ff-8cfb716a272dn@googlegroups.com>
Subject: problem with NINT() and DOUBLEPRECISION input values
From: urbanjost@comcast.net (John)
Injection-Date: Wed, 16 Nov 2022 13:09:42 +0000
Content-Type: text/plain; charset="UTF-8"
 by: John - Wed, 16 Nov 2022 13:09 UTC

I am on a Linux mint box using KVM and
running a virtual box that is
OpenBSD mo.my.domain 7.2 GENERIC#381 i386
using
GNU Fortran (GCC) 11.2.0
and am getting negative values from NINT()
on doubleprecision values when I do not expect
them.

I thought NINT() took any KIND of REAL so I did
not expect that; but it has been a while since
I ran on i386, and I am on a virtual box.

If I do a NINT(REAL(value)) instead of NINT(value)
I get the expected INTEGER value.

Any reason I should expect NINT() to not work
with values still within the range of the default
INTEGER kind?

Anyone have a 32-bit box with gfortran on it that
could see if they start getting negative values
with doubleprecision input values below HUGE(0)?

> program testit
> use,intrinsic :: iso_fortran_env, only : int8, int16, int32, int64
> use,intrinsic :: iso_fortran_env, only : real32, real64, real128
> implicit none
> doubleprecision :: value
> integer :: i
> do i=0,huge(0)-1
> value=i
> if(nint(value).lt.0)then
> write(*,*)'VALUE:',value
> write(*,*)'REAL(VALUE):',real(value)
> write(*,*)'NINT(REAL(VALUE)):',nint(real(value))
> write(*,*)'NINT(VALUE):',nint(value-1)
> write(*,*)'NINT(VALUE):',nint(value)
> write(*,*)'NINT(VALUE):',nint(value+1)
> write(*,*)'INT:',int(value-1)
> write(*,*)'INT:',int(value)
> write(*,*)'INT:',int(value+1)
> exit
> endif
> enddo
> write(*,*)'value:',value
> write(*,*)'huge(0):',huge(0)
> write(*,*)'huge(0_int64):',huge(0_int64)
> write(*,*)'huge(0_int32):',huge(0_int32)
> write(*,*)'huge(0_int16):',huge(0_int16)
> write(*,*)'huge(0_int8):',huge(0_int8)
> end program testit
>
> VALUE: 2097153.0000000000
> REAL(VALUE): 2097153.00
> NINT(REAL(VALUE)): 2097153
> NINT(VALUE): 2097152
> NINT(VALUE): -1
> NINT(VALUE): 2097154
> INT: 2097152
> INT: 2097153
> INT: 2097154
> value: 2097153.0000000000
> huge(0): 2147483647
> huge(0_int64): 9223372036854775807
> huge(0_int32): 2147483647
> huge(0_int16): 32767
> huge(0_int8): 127

Re: problem with NINT() and DOUBLEPRECISION input values

<tl37jn$2dbrs$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: sgk@REMOVEtroutmask.apl.washington.edu (Steven G. Kargl)
Newsgroups: comp.lang.fortran
Subject: Re: problem with NINT() and DOUBLEPRECISION input values
Date: Wed, 16 Nov 2022 17:45:27 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <tl37jn$2dbrs$1@dont-email.me>
References: <20eed3bf-a3db-4841-90ff-8cfb716a272dn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 16 Nov 2022 17:45:27 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="84cc571a0420e846a0574112a1659310";
logging-data="2535292"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lcfa4SqJU6TcIZeMRKQ9g"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:0Jn4/GyHuSjHgsIUku/wjemPs0U=
 by: Steven G. Kargl - Wed, 16 Nov 2022 17:45 UTC

On Wed, 16 Nov 2022 05:09:41 -0800, John wrote:

> I am on a Linux mint box using KVM and
> running a virtual box that is
> OpenBSD mo.my.domain 7.2 GENERIC#381 i386
> using
> GNU Fortran (GCC) 11.2.0
> and am getting negative values from NINT()
> on doubleprecision values when I do not expect
> them.

John,

At least on FreeBSD, gfortran maps nint() to the
libm function lroundf(). I suspect that you're
seeing an OpenBSD bug. Writing the equivalent
test in C and linking with libm should either
verify my assertion or invalidate it.

--
steve

Re: problem with NINT() and DOUBLEPRECISION input values

<92b2250a-c42b-49e1-a2cf-c74fdc613aden@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:7401:0:b0:3a5:41fd:2216 with SMTP id p1-20020ac87401000000b003a541fd2216mr22525049qtq.338.1668624244743;
Wed, 16 Nov 2022 10:44:04 -0800 (PST)
X-Received: by 2002:a05:622a:a0b:b0:3a5:4fdb:ac40 with SMTP id
bv11-20020a05622a0a0b00b003a54fdbac40mr22219305qtb.268.1668624244550; Wed, 16
Nov 2022 10:44:04 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.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, 16 Nov 2022 10:44:04 -0800 (PST)
In-Reply-To: <20eed3bf-a3db-4841-90ff-8cfb716a272dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=108.74.162.237; posting-account=r3eTlQoAAAABvPStTQdpPnri4DjaXXqT
NNTP-Posting-Host: 108.74.162.237
References: <20eed3bf-a3db-4841-90ff-8cfb716a272dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <92b2250a-c42b-49e1-a2cf-c74fdc613aden@googlegroups.com>
Subject: Re: problem with NINT() and DOUBLEPRECISION input values
From: robertpaulcorbett@gmail.com (Robert Corbett)
Injection-Date: Wed, 16 Nov 2022 18:44:04 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3782
 by: Robert Corbett - Wed, 16 Nov 2022 18:44 UTC

I do not know what the problem is, but note that

2**21 = 2097152

Therefore, 2097153.0D0 is the smallest positive
integer value where a bit is set in the low-order
32-bits of its IEEE float64 representation. It might
be interesting to know what the value of

NINT(2097155.0D0)

is.

Bob Corbett

On Wednesday, November 16, 2022 at 5:09:43 AM UTC-8, urba...@comcast.net wrote:
> I am on a Linux mint box using KVM and
> running a virtual box that is
> OpenBSD mo.my.domain 7.2 GENERIC#381 i386
> using
> GNU Fortran (GCC) 11.2.0
> and am getting negative values from NINT()
> on doubleprecision values when I do not expect
> them.
>
> I thought NINT() took any KIND of REAL so I did
> not expect that; but it has been a while since
> I ran on i386, and I am on a virtual box.
>
> If I do a NINT(REAL(value)) instead of NINT(value)
> I get the expected INTEGER value.
>
> Any reason I should expect NINT() to not work
> with values still within the range of the default
> INTEGER kind?
>
> Anyone have a 32-bit box with gfortran on it that
> could see if they start getting negative values
> with doubleprecision input values below HUGE(0)?
>
> > program testit
> > use,intrinsic :: iso_fortran_env, only : int8, int16, int32, int64
> > use,intrinsic :: iso_fortran_env, only : real32, real64, real128
> > implicit none
> > doubleprecision :: value
> > integer :: i
> > do i=0,huge(0)-1
> > value=i
> > if(nint(value).lt.0)then
> > write(*,*)'VALUE:',value
> > write(*,*)'REAL(VALUE):',real(value)
> > write(*,*)'NINT(REAL(VALUE)):',nint(real(value))
> > write(*,*)'NINT(VALUE):',nint(value-1)
> > write(*,*)'NINT(VALUE):',nint(value)
> > write(*,*)'NINT(VALUE):',nint(value+1)
> > write(*,*)'INT:',int(value-1)
> > write(*,*)'INT:',int(value)
> > write(*,*)'INT:',int(value+1)
> > exit
> > endif
> > enddo
> > write(*,*)'value:',value
> > write(*,*)'huge(0):',huge(0)
> > write(*,*)'huge(0_int64):',huge(0_int64)
> > write(*,*)'huge(0_int32):',huge(0_int32)
> > write(*,*)'huge(0_int16):',huge(0_int16)
> > write(*,*)'huge(0_int8):',huge(0_int8)
> > end program testit
> >
> > VALUE: 2097153.0000000000
> > REAL(VALUE): 2097153.00
> > NINT(REAL(VALUE)): 2097153
> > NINT(VALUE): 2097152
> > NINT(VALUE): -1
> > NINT(VALUE): 2097154
> > INT: 2097152
> > INT: 2097153
> > INT: 2097154
> > value: 2097153.0000000000
> > huge(0): 2147483647
> > huge(0_int64): 9223372036854775807
> > huge(0_int32): 2147483647
> > huge(0_int16): 32767
> > huge(0_int8): 127

Re: problem with NINT() and DOUBLEPRECISION input values

<375dfb9d-f4e0-40eb-b509-ae7b202348a8n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ae9:e844:0:b0:6fa:aee9:9d40 with SMTP id a65-20020ae9e844000000b006faaee99d40mr21858377qkg.194.1668642451384;
Wed, 16 Nov 2022 15:47:31 -0800 (PST)
X-Received: by 2002:a37:a8cd:0:b0:6fa:9d10:1784 with SMTP id
r196-20020a37a8cd000000b006fa9d101784mr21769031qke.627.1668642451125; Wed, 16
Nov 2022 15:47:31 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Wed, 16 Nov 2022 15:47:30 -0800 (PST)
In-Reply-To: <20eed3bf-a3db-4841-90ff-8cfb716a272dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:2807:3d77:1031:3372;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:2807:3d77:1031:3372
References: <20eed3bf-a3db-4841-90ff-8cfb716a272dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <375dfb9d-f4e0-40eb-b509-ae7b202348a8n@googlegroups.com>
Subject: Re: problem with NINT() and DOUBLEPRECISION input values
From: gah4@u.washington.edu (gah4)
Injection-Date: Wed, 16 Nov 2022 23:47:31 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1884
 by: gah4 - Wed, 16 Nov 2022 23:47 UTC

On Wednesday, November 16, 2022 at 5:09:43 AM UTC-8, urba...@comcast.net wrote:

(snip)

> Anyone have a 32-bit box with gfortran on it that
> could see if they start getting negative values
> with doubleprecision input values below HUGE(0)?
value: 2147483646.00000
huge(0): 2147483647
huge(0_int64): 9223372036854775807
huge(0_int32): 2147483647
huge(0_int16): 32767
huge(0_int8): 127

This is from: GNU Fortran (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
and: Linux pion.egn2.com 2.6.18-164.11.1.el5xen #1 SMP Wed Jan 20 01:48:45 EST 2010 i686 athlon i386 GNU/Linux

I had to put in constants for the intxxx values, as it doesn't have them.

Re: problem with NINT() and DOUBLEPRECISION input values

<tl3t5q$2f8rm$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: sgk@REMOVEtroutmask.apl.washington.edu (Steven G. Kargl)
Newsgroups: comp.lang.fortran
Subject: Re: problem with NINT() and DOUBLEPRECISION input values
Date: Wed, 16 Nov 2022 23:53:30 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <tl3t5q$2f8rm$1@dont-email.me>
References: <20eed3bf-a3db-4841-90ff-8cfb716a272dn@googlegroups.com>
<375dfb9d-f4e0-40eb-b509-ae7b202348a8n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 16 Nov 2022 23:53:30 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="8973e93bb1e6ba22c2526d429fb9c3fe";
logging-data="2597750"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+z3lIjVqT+Bk4UPcU0Ed5i"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:RuUg/2bThG7+O3PI3I+7FH8XcGU=
 by: Steven G. Kargl - Wed, 16 Nov 2022 23:53 UTC

On Wed, 16 Nov 2022 15:47:30 -0800, gah4 wrote:
>
> This is from: GNU Fortran (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)

20080704 is a few years beyond its use-by-date.

> and: Linux pion.egn2.com 2.6.18-164.11.1.el5xen #1 SMP Wed Jan 20 01:48:45 EST 2010 i686 athlon i386 GNU/Linux
>
> I had to put in constants for the intxxx values, as it doesn't have them.

I suspect some bug fixes and features of the Fortran language may
have been implemented in the last 14 years.

--
steve

Re: problem with NINT() and DOUBLEPRECISION input values

<59e9dac1-4fe5-4e5c-847a-bc27106f7eebn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:31a6:b0:6fa:172:c37d with SMTP id bi38-20020a05620a31a600b006fa0172c37dmr21780312qkb.92.1668645770028;
Wed, 16 Nov 2022 16:42:50 -0800 (PST)
X-Received: by 2002:ae9:df02:0:b0:6fa:349b:7ba9 with SMTP id
t2-20020ae9df02000000b006fa349b7ba9mr21710616qkf.339.1668645769830; Wed, 16
Nov 2022 16:42:49 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Wed, 16 Nov 2022 16:42:49 -0800 (PST)
In-Reply-To: <tl3t5q$2f8rm$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:2807:3d77:1031:3372;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:2807:3d77:1031:3372
References: <20eed3bf-a3db-4841-90ff-8cfb716a272dn@googlegroups.com>
<375dfb9d-f4e0-40eb-b509-ae7b202348a8n@googlegroups.com> <tl3t5q$2f8rm$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <59e9dac1-4fe5-4e5c-847a-bc27106f7eebn@googlegroups.com>
Subject: Re: problem with NINT() and DOUBLEPRECISION input values
From: gah4@u.washington.edu (gah4)
Injection-Date: Thu, 17 Nov 2022 00:42:50 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2273
 by: gah4 - Thu, 17 Nov 2022 00:42 UTC

On Wednesday, November 16, 2022 at 3:53:34 PM UTC-8, Steven G. Kargl wrote:
> On Wed, 16 Nov 2022 15:47:30 -0800, gah4 wrote:
> > This is from: GNU Fortran (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
> 20080704 is a few years beyond its use-by-date.
> > and: Linux pion.egn2.com 2.6.18-164.11.1.el5xen #1 SMP Wed Jan 20 01:48:45 EST 2010 i686 athlon i386 GNU/Linux
> > I had to put in constants for the intxxx values, as it doesn't have them.

> I suspect some bug fixes and features of the Fortran language may
> have been implemented in the last 14 years.

I think the one I use more is 64 bit, though, and the OP asked for 32 bit.

That is on ScientificLinux, the version that installs with it.
I did try to update once, but it failed.

In any case, it seemed useful as a comparison to see if/when
the bug appeared. And it is interesting to see where it
did go negative, where it wasn't so obvious.

I do sometimes use the C compiler on that machine, though
it is also old.

Re: problem with NINT() and DOUBLEPRECISION input values

<51ce1183-7b1a-420b-b6c8-eceda4c61684n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a0c:e7ce:0:b0:4b9:ef84:afc3 with SMTP id c14-20020a0ce7ce000000b004b9ef84afc3mr2438121qvo.57.1668693355108;
Thu, 17 Nov 2022 05:55:55 -0800 (PST)
X-Received: by 2002:a05:622a:1353:b0:39d:3b6:3779 with SMTP id
w19-20020a05622a135300b0039d03b63779mr2243646qtk.196.1668693354970; Thu, 17
Nov 2022 05:55:54 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Thu, 17 Nov 2022 05:55:54 -0800 (PST)
In-Reply-To: <59e9dac1-4fe5-4e5c-847a-bc27106f7eebn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:9400:6476:7e17:88f0;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:9400:6476:7e17:88f0
References: <20eed3bf-a3db-4841-90ff-8cfb716a272dn@googlegroups.com>
<375dfb9d-f4e0-40eb-b509-ae7b202348a8n@googlegroups.com> <tl3t5q$2f8rm$1@dont-email.me>
<59e9dac1-4fe5-4e5c-847a-bc27106f7eebn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <51ce1183-7b1a-420b-b6c8-eceda4c61684n@googlegroups.com>
Subject: Re: problem with NINT() and DOUBLEPRECISION input values
From: urbanjost@comcast.net (John)
Injection-Date: Thu, 17 Nov 2022 13:55:55 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2741
 by: John - Thu, 17 Nov 2022 13:55 UTC

Not sure I am testing what you suggested well enough, but this did not indicate any problem. Maybe some type of type mismatch;
the odd numbers all start returning -1; which makes the point about the "magic number" being the first incorrect result even more interesting;
maybe a type mismatch issue(?). So works if input value is REAL instead of DOUBLEPRECISION; works on 64-bit OpenBSD; going to try some intentional type mismatches to see if I can reproduce at the C level; opened a bugzilla report in gfortran as I guessing it might be something simple as it works fine for default REAL and C confidence test passed. If that is not the type of C test intended let me know.

#include <math.h>
#include <errno.h>
#include <fenv.h>
#include <stdio.h>
#include <limits.h>
main(){
double xl;
int ierr;
int i;
int iout;
printf("size of xl is %ld\n",sizeof(xl));
for(i=0;i<=INT_MAX;i=i+1){
xl=i;
errno=0;
feclearexcept(FE_ALL_EXCEPT);
iout=lroundf(xl);
if(iout < 0){
printf("%d xl rounded is %d \n",i,iout);
if (errno != 0){
printf("errno is %d\n",errno);
ierr = fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW);
printf("ERRNO:%d:FPE: %d\n" , errno, ierr);
}
break;
}
} printf("all done \%d\n",i);

Re: problem with NINT() and DOUBLEPRECISION input values

<tl5sal$2mkd4$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: sgk@REMOVEtroutmask.apl.washington.edu (Steven G. Kargl)
Newsgroups: comp.lang.fortran
Subject: Re: problem with NINT() and DOUBLEPRECISION input values
Date: Thu, 17 Nov 2022 17:51:17 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <tl5sal$2mkd4$1@dont-email.me>
References: <20eed3bf-a3db-4841-90ff-8cfb716a272dn@googlegroups.com>
<375dfb9d-f4e0-40eb-b509-ae7b202348a8n@googlegroups.com>
<tl3t5q$2f8rm$1@dont-email.me>
<59e9dac1-4fe5-4e5c-847a-bc27106f7eebn@googlegroups.com>
<51ce1183-7b1a-420b-b6c8-eceda4c61684n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 17 Nov 2022 17:51:17 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="8973e93bb1e6ba22c2526d429fb9c3fe";
logging-data="2838948"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18SPig3xk3iGhgF0xaMemHQ"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:+3VKTueFvVCYB2i2TAxRHcWm5Hk=
 by: Steven G. Kargl - Thu, 17 Nov 2022 17:51 UTC

On Thu, 17 Nov 2022 05:55:54 -0800, John wrote:

> Not sure I am testing what you suggested well enough, but this did not indicate any problem. Maybe some type of type mismatch;
> the odd numbers all start returning -1; which makes the point about the "magic number" being the first incorrect result even more interesting;
> maybe a type mismatch issue(?). So works if input value is REAL instead of DOUBLEPRECISION; works on 64-bit OpenBSD; going to try some intentional type mismatches to see if I can reproduce at the C level; opened a bugzilla report in gfortran as I guessing it might be something simple as it works fine for default REAL and C confidence test passed. If that is not the type of C test intended let me know.

The first thing I would do is look under gfortran's hood.
Compile

function foo1(x)
real foo1, x
foo1 = nint(x)
end function

function foo2(x)
double precision foo2, x
foo2 = nint(x)
end function

with -fdump-tree-original. Look at the file to see if
you have __builtin_lroundx() calls with x = 'f' or missing.

Next compile to assembly and check if you are getting calls
to libm functions lroundf() and lround(). If you are, this
is not a gfortran bug. It is an OpenBSD on i386 bug.

I would then look at OpenBSD to see if any changes have
occurred that might be related to lround().

https://cvsweb.openbsd.org/src/lib/libm/src/?sortby=date#dirlist

--
steve

Re: problem with NINT() and DOUBLEPRECISION input values

<792b4cb2-3050-4560-a6a5-7ff80fab0eadn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:5f04:b0:4bb:8383:c8d7 with SMTP id lx4-20020a0562145f0400b004bb8383c8d7mr9102531qvb.74.1668815547852;
Fri, 18 Nov 2022 15:52:27 -0800 (PST)
X-Received: by 2002:a0c:f650:0:b0:4c6:8aa8:fec4 with SMTP id
s16-20020a0cf650000000b004c68aa8fec4mr7736857qvm.92.1668815547689; Fri, 18
Nov 2022 15:52:27 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Fri, 18 Nov 2022 15:52:27 -0800 (PST)
In-Reply-To: <tl5sal$2mkd4$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:1f2:8dc0:b229:5dac;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:1f2:8dc0:b229:5dac
References: <20eed3bf-a3db-4841-90ff-8cfb716a272dn@googlegroups.com>
<375dfb9d-f4e0-40eb-b509-ae7b202348a8n@googlegroups.com> <tl3t5q$2f8rm$1@dont-email.me>
<59e9dac1-4fe5-4e5c-847a-bc27106f7eebn@googlegroups.com> <51ce1183-7b1a-420b-b6c8-eceda4c61684n@googlegroups.com>
<tl5sal$2mkd4$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <792b4cb2-3050-4560-a6a5-7ff80fab0eadn@googlegroups.com>
Subject: Re: problem with NINT() and DOUBLEPRECISION input values
From: urbanjost@comcast.net (John)
Injection-Date: Fri, 18 Nov 2022 23:52:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3224
 by: John - Fri, 18 Nov 2022 23:52 UTC

On Thursday, November 17, 2022 at 12:51:21 PM UTC-5, Steven G. Kargl wrote:
> On Thu, 17 Nov 2022 05:55:54 -0800, John wrote:
>
> > Not sure I am testing what you suggested well enough, but this did not indicate any problem. Maybe some type of type mismatch;
> > the odd numbers all start returning -1; which makes the point about the "magic number" being the first incorrect result even more interesting;
> > maybe a type mismatch issue(?). So works if input value is REAL instead of DOUBLEPRECISION; works on 64-bit OpenBSD; going to try some intentional type mismatches to see if I can reproduce at the C level; opened a bugzilla report in gfortran as I guessing it might be something simple as it works fine for default REAL and C confidence test passed. If that is not the type of C test intended let me know.
> The first thing I would do is look under gfortran's hood.
> Compile
>
> function foo1(x)
> real foo1, x
> foo1 = nint(x)
> end function
>
> function foo2(x)
> double precision foo2, x
> foo2 = nint(x)
> end function
>
> with -fdump-tree-original. Look at the file to see if
> you have __builtin_lroundx() calls with x = 'f' or missing.
>
> Next compile to assembly and check if you are getting calls
> to libm functions lroundf() and lround(). If you are, this
> is not a gfortran bug. It is an OpenBSD on i386 bug.
>
> I would then look at OpenBSD to see if any changes have
> occurred that might be related to lround().
>
> https://cvsweb.openbsd.org/src/lib/libm/src/?sortby=date#dirlist
>
> --
> steve
have some time constraints right now, but thanks for the great roadmap. I will use all of that.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor