Re: problem with very small numbers - g95 versus gfortran
- From: "James Van Buskirk" <not_valid@xxxxxxxxxxx>
- Date: Thu, 29 May 2008 01:12:19 -0600
"Steven G. Kargl" <kargl@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:g1lhvl$3bv$1@xxxxxxxxxxxxxxxxxxxxxxxxxx
Please read about -ffloat-store.
You mean:
http://gcc.gnu.org/onlinedocs/gcc/Disappointments.html#index-ffloat_002dstore-2889
? :) Well, OK:
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-ffloat_002dstore-708
but how should this have any effect in the current case? Don't
all compilers in question issue calls to _ccosf, _ccos, and _ccosl
so that a compiler option won't affect the outcome? The overflow,
if it happens, does so after the invocation of the library
function and before its return as the result is in range for a
model number in all cases.
Now, if you really want to see some difference, consider what
happens when we do the same with initialization expressions so that
gfortran uses mpfr rather than the above library functions:
C:\gcc_mingw64a\test\denormal>type mega2.f90
program mega2
implicit none
real(4), parameter :: pi = 4*atan(1.0)
real(4), parameter :: a4 = 2
real(4), parameter :: b4 = log(huge(a4))+log(a4)*1.1
complex(4), parameter :: c4 = cmplx(pi/4,b4,kind(c4))
complex(4), parameter :: x4 = cos(c4)
integer(kind(1)+int(1/x4)) i4
real(8), parameter :: a8 = 2
real(8), parameter :: b8 = log(huge(a8))+log(a8)*1.1
complex(8), parameter :: c8 = cmplx(pi/4,b8,kind(c8))
complex(8), parameter :: x8 = cos(c8)
integer(kind(1)+int(1/x8)) i8
real(10), parameter :: a10 = 2
real(10), parameter :: b10 = log(huge(a10))+log(a10)*1.1
complex(10), parameter :: c10 = cmplx(pi/4,b10,kind(c10))
complex(10), parameter :: x10 = cos(c10)
integer(kind(1)+int(1/x10)) i10
write(*,*) x4
write(*,*) kind(i4)
write(*,*) x8
write(*,*) kind(i8)
write(*,*) x10
write(*,*) kind(i10)
end program mega2
C:\gcc_mingw64a\test\denormal>x86_64-pc-mingw32-gfortran mega2.f90 -omega2
C:\gcc_mingw64a\test\denormal>mega2
( 2.57885078E+38,-2.57885078E+38)
4
( 1.36239662574516360E+308,-1.36239668529741519E+308)
4
( 9.01647863800489008786E+4931,-9.01647903212771289082E+4931)
4
--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end
.
- References:
- 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
- From: James Van Buskirk
- 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
- 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
- From: Steven G. Kargl
- problem with very small numbers - g95 versus gfortran
- Prev by Date: Interfacing between Fortran and C - a little utility
- Next by Date: Re: 1.0d0 stored as integer?
- Previous by thread: Re: problem with very small numbers - g95 versus gfortran
- Next by thread: Re: problem with very small numbers - g95 versus gfortran
- Index(es):