Re: problem with very small numbers - g95 versus gfortran
- From: "James Van Buskirk" <not_valid@xxxxxxxxxxx>
- Date: Wed, 28 May 2008 19:43:52 -0600
"e p chandler" <epc8@xxxxxxxx> wrote in message
news:cba2a6c6-2677-42e1-a6a8-8ce070b851c1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Apparently there is a problem with assigning a very small double
precision literal to a 10-byte real. (MinGW on Win32). Assigning a
literal of the proper kind resolves the problem.
Yeah, and FX relates to me that it's not only g95 that can run into
problems with denormals. He gave an example where BOZ
representations of denormals could be converted improperly, but
inconsistently so in gfortran and said that other compilers faced
problems. Likely the problem is that denormals are a special case
so that code where they are handled is not as well tested as the
normal case.
Just for fun, tell me what g95 does with the following:
C:\gcc_mingw64a\test\denormal>type denormal.f90
real*10 x,y
x=1d-306
y=1e-306_10
print *,306,x,y
print '(2(e30.20e4,/))',x,y
x=1d-307
y=1e-307_10
print *,307,x,y
print '(2(e30.20e4,/))',x,y
x=1d-308
y=1e-308_10
print *,308,x,y
print '(2(e30.20e4,/))',x,y
print*, tiny(1.0d0), tiny(1.0e0_10)
x=2.23d-308
y=2.23e-308_10
print*,'tiny+',x,y
print '(2(e30.20e4,/))',x,y
print '(z16.16)', transfer(2.23d-308,0_8)
x=2.22d-308
y=2.22e-308_10
print*,'tiny-',x,y
print '(2(e30.20e4,/))',x,y
print '(z16.16)', transfer(2.22d-308,0_8)
end
C:\gcc_mingw64a\test\denormal>x86_64-pc-mingw32-gfortran
denormal.f90 -odenormal
C:\gcc_mingw64a\test\denormal>denormal
306 1.00000000000000002790E-0306 1.00000000000000000003E-0306
0.10000000000000000279E-0305
0.10000000000000000000E-0305
307 9.99999999999999909327E-0308 1.00000000000000000003E-0307
0.99999999999999990933E-0307
0.10000000000000000000E-0306
308 9.99999999999999909327E-0309 9.99999999999999999974E-0309
0.99999999999999990933E-0308
0.99999999999999999997E-0308
2.22507385850720138E-308 3.36210314311209350626E-4932
tiny+ 2.23000000000000010412E-0308 2.22999999999999999990E-0308
0.22300000000000001041E-0307
0.22299999999999999999E-0307
0010091177587F83
tiny- 2.22000000000000013467E-0308 2.22000000000000000006E-0308
0.22200000000000001347E-0307
0.22200000000000000001E-0307
000FF6A8EBE79958
C:\gcc_mingw64a\test\denormal>gfortran -v
Using built-in specs.
Target: x86_64-pc-mingw32
Configured with:
.../gcc/configure --prefix=/var/tmp/rt --with-sysroot=/var/tmp/r
t --host=i686-pc-mingw32 --target=x86_64-pc-mingw32 -q --silent
Thread model: win32
gcc version 4.4.0 20080523 (experimental) (GCC)
--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end
.
- Follow-Ups:
- Re: problem with very small numbers - g95 versus gfortran
- From: e p chandler
- Re: problem with very small numbers - g95 versus gfortran
- From: James Van Buskirk
- Re: problem with very small numbers - g95 versus gfortran
- References:
- problem with very small numbers - g95 versus gfortran
- From: e p chandler
- problem with very small numbers - g95 versus gfortran
- Prev by Date: Re: Unsigned in CVF
- Next by Date: Re: one-liner for characater replacement
- Previous by thread: problem with very small numbers - g95 versus gfortran
- Next by thread: Re: problem with very small numbers - g95 versus gfortran
- Index(es):
Relevant Pages
|
|