i have read that when have mixed types such as integer and real in for example
r=a/i the result will be real*4
but now suppose have set
integer*8 a,r
then will
r=a/i be of precision real*8 or will it just be of default precision real*4 ?
integer*8 lisf(17)
nn=3
lisf=[1,1,2,(0,i=4,4*nn+5)]
print*,lisf
end
But on the screen the entries after the 4th are invalid numbers,NOT all 0's. And on other occasions of similar types it does not even print out the entries >4 and if have more steps,assigning loops etc. get run time errors...
if all the variables at first are integer isn't integer multiplication supposed to be exact ?
Even though i am getting very large numbers(as long as not overflow): anyway at the end i will have to divide a floating point number by the integer(s). There are several steps and at first i just...
if for example array is allocatable say of one dimension and
already allocated then is it automatically set all elements to 0?
I had always been doing
array=0
which i have also seen in the literature of other people doing
In fact i have been doing so for all arrays of any dimensions real or...
all the sudden strange behavior using above compiler. For illustration My source file is named U1.f95 with the following code
------------------
open (1, file="modinc395.t",status="old",position="rewind",&
action="read",iostat=ierror)
read(1,'(2(i3))') nps,npmx ; print*,"nps,npmx",nps,npmx...
integer:: ls1(2,4),mlis(2,4)
lenrec=1
nps=4
write(1,*)"ls1(1,1)",ls1(1,1)
write(1,*)"ls1(1,:)",ls1(1,:)
i=1
do while(ls1(1,i)==lsl(2,i).and.i<nps+1)
i=i+1
enddo
end
First of all it ignores the write statements if omit the do while...
As it is it gives 'undefined reference error...
Has anyone had this problem with the gfortran compiler
call rr(1,1)
end
recursive subroutine rr(j,k)
if(j>3) then
print*,k
else
k=k*j
call rr(j+1,k)
endif
end
Clearly everything is well defined and should not be getting any run time errors such as 'segmentation... invalid...
In an integer do loop such as
do i=lower,iupper
.... ; enddo
More specifically with an integer do loop variable default step 1 whose upper limit is atleast as great as the lowerwill it always be the case that after the loop normally exits, eg assuming nothing in the loop such that one may...
i have used
gfortran.exe uses.f95 and use gfortran.exe myfile.f95 such as
this aLL files that worked perfectly and compiled no problem
prior now get message. eg Get error
:\Simply Fortran 2>gfortran.exe uses.f95
his version of c:\Simply Fortran 2\gfortran.exe is not compatible with the...
integer*1 n1,nps
common n1,nps
n1=5
nps=4
call try
end
subroutine try
print*,"nps",nps,"n1",n1
end
NOw it should printout 4 for nps and 5 for n1 but it does NOT
why ?
integer*1 n1,nps
common n1,nps
n1=5
nps=4
call try
end
subroutine try
print*,"nps",nps,"n1",n1
end
BUT it does NOT printout 4 for nps nor 5 for n1
what is wrong ?
Also how do i get this post to printout the code in the box for code ? that others are able to do ?
common lena,np,nps
np=2;nps=3; lena=0
i=1;i1=0 ; call jkz(i,i1)
end
recursive subroutine jkz(i9,ir)
common lena,np,nps
print*,"i9",i9," ir",ir
if (i9<nps+1) then ; if (i9<nps) then ; if (i9<nps-1) then ; do ii=0,min(np,2*np-ir)
m1=i9+1;m2=ir+ii;call jkz(m1,m2) ; enddo; else ; do...
The following compiles ok with no error messages but gives
Segmentation fault - invalid memory reference. when run the executable
module inc
integer*1:: i,j,nps
integer*1,allocatable::ib(:)
type mixed ; integer*1,allocatable :: ib(:) ; real val ; end type mixed
type(mixed), allocatable ...
i want to pass variable array size to subroutine. the following will illustrate
integer*1 i,is ,j,j1,j2,m1,m2,np,npmx,nps
integer*1,allocatable::ilisin(:),ils(:)
common nps,npmx,np
npmx=2;nps=3
allocate(ilisin(nps),ils(2*nps-min(3,nps)))
call wigd(1,ilisin,0,ils)
end
subroutine...
I need to have a mixed type array with short integer*1 values first and a real value last. I read all the examples and am
doing everything correct but it refuses to work !! This is only a simple trial example to try first. Later i will need to have much more than just
11 integer values and need...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.