compilation error

74 views
Skip to first unread message

mjlegaz...@gmail.com

unread,
Jan 29, 2018, 1:15:30 AM1/29/18
to gg95
Hello.

I am very new in programing and in use fortran an g95. I use g95 in windows.

The part of the program that I am trying to compile is:

implicit none
real:: s, x(N), p(N)
integrando=0.5*(p(1)+4.72*x(1)*x(2))**2+0.5*(p(2)+4.72*x(1)*x(2)+3.e+09*x(3)*x(2)-4.72*x(6))**2
integrando=integrando+0.5*(p(3)+3.e+09*x(3)*x(2)-1.5.e+04*x(3)*x(5)+8.e+07*x(3)**2-4.72*x(1)*x(2))**2
integrando=integrando+0.5*(p(4)-3.e+09*x(3)*x(2))**2+0.5*(p(5)+1.5e+04*x(5)*x(3))**2
integrando=integrando+0.5*(p(6)+1.5.e+04*x(5)*x(3)+x(6))**2+0.5*(p(7)+4.e+07*x(3)**2)**2
end function 


The compiler give me an error : expected a right parenthesis in expression at (1)

This error appear after two lines:


integrando=integrando+0.5*(p(3)+3.e+09*x(3)*x(2)-1.5.e+04*x(3)*x(5)+8.e+07*x(3)**2-4.72*x(1)*x(2))**2


integrando=integrando+0.5*(p(6)+1.5.e+04*x(5)*x(3)+x(6))**2+0.5*(p(7)+4.e+07*x(3)**2)**2


I attach a file with the image of error.

I revised the  parentheses several times. I can not see a wrong parenthesis.

I would very grateful if someone could help me.

Really grateful

Thank you so much.

María José

error.png

Darius Markauskas

unread,
Jan 29, 2018, 7:08:01 AM1/29/18
to gg...@googlegroups.com
The error is shown in your screenshot:
"1.5.e"
It should be "1.5e" or just "1.5".

And better use Gfortran instead of G95.




--
You received this message because you are subscribed to the Google Groups "gg95" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gg95+unsubscribe@googlegroups.com.
To post to this group, send email to gg...@googlegroups.com.
Visit this group at https://groups.google.com/group/gg95.
For more options, visit https://groups.google.com/d/optout.

mjlegaz...@gmail.com

unread,
Jan 30, 2018, 12:52:18 AM1/30/18
to gg95
Hello Darmar.

Thank you very much for your answer.

The program has compiled without errors

What are the advantages of Gfortran?

Now, my problem is that the results are not that should be, I do not know why?. I ran the same program with other function and it worked.

Please, if some Fortran user it is interested in help me please send me an email. 

Thank you again Darmar.

Darius Markauskas

unread,
Jan 30, 2018, 7:05:19 AM1/30/18
to gg...@googlegroups.com
"What are the advantages of Gfortran? "

G95 is not developed / actively maintained anymore.

Walt Brainerd

unread,
Jan 30, 2018, 11:19:08 AM1/30/18
to gg...@googlegroups.com
How are your results wrong?
In numerical computations using different compilers and different hardware,
you must expect answers to differ.

If the answer is completely different, it can be because of errors in the program
or an unstable algorithm.

It is possible, but very unlikely, that there is a bug in the compiler.

--
You received this message because you are subscribed to the Google Groups "gg95" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gg95+unsubscribe@googlegroups.com.
To post to this group, send email to gg...@googlegroups.com.
Visit this group at https://groups.google.com/group/gg95.
For more options, visit https://groups.google.com/d/optout.



--
Walt Brainerd

ziggy76

unread,
Jan 31, 2018, 12:11:27 PM1/31/18
to gg95
Hello,

What do you mean by 'I ran the same program with other function and it worked.' ?
Without more information, it's impossible to help you.
Most of the time the source of the problem is a little typing mistake like the previous one.

Regards

mjlegaz...@gmail.com

unread,
Feb 1, 2018, 2:07:33 AM2/1/18
to gg95
Hello.

Thank you Darmar for your answer.

Thank you Walt and Ziggy76. The problem was a  mistake in the program.

Would like to ask another question.

I know that squaring is written:  x**2

My question is if the next two expression are correct:

x(2)**0.5+x(1)

x(2)**-0.5

I mean when I have to raise to 0.5 or -0.5. How I should write this?

Thank you so much, again.

María José


El lunes, 29 de enero de 2018, 7:15:30 (UTC+1), mjlegaz...@gmail.com escribió:

ziggy76

unread,
Feb 1, 2018, 10:31:25 AM2/1/18
to gg95

I think the best way is like this example :

print *,9.0**(-0.5)


which gives the good answer :

  0.333333343

When you have a question like this one, just try.
A simple test program is just 2 lines long :


print *,9.0**(-0.5)
end


Regards

María José Legaz Almansa

unread,
Feb 3, 2018, 12:33:53 AM2/3/18
to gg...@googlegroups.com
Hello .

Thank you for you answer ziggy76. Thank you very much.

I have another problem of compilation.

I attach the file "mio" with the part of program which I am trying to compile.

I attach the image of the error in the compiler.

I would very grateful if someone could help me.

Really grateful

Thank you so much.

María José




--
You received this message because you are subscribed to a topic in the Google Groups "gg95" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gg95/FulShiN5xy8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gg95+unsubscribe@googlegroups.com.
mio.f95
error compilador.png

John S. Urban

unread,
Feb 3, 2018, 7:38:46 PM2/3/18
to gg...@googlegroups.com

Your source lines are longer than 132 columns. That is why the messages are warning that the lines are being truncated.  Although there are often compiler options to allow lines to be longer than the standard limit of 132, you should break your lines up and use continuation lines.

To unsubscribe from this group and all its topics, send an email to gg95+uns...@googlegroups.com.


To post to this group, send email to gg...@googlegroups.com.
Visit this group at https://groups.google.com/group/gg95.
For more options, visit https://groups.google.com/d/optout.

 

--

You received this message because you are subscribed to the Google Groups "gg95" group.

To unsubscribe from this group and stop receiving emails from it, send an email to gg95+uns...@googlegroups.com.

María José Legaz Almansa

unread,
Feb 5, 2018, 1:52:42 AM2/5/18
to gg...@googlegroups.com
Hello John.

I have used & to break lines  and it have worked.


Thank you so much

María José

To unsubscribe from this group and all its topics, send an email to gg95+unsubscribe@googlegroups.com.


To post to this group, send email to gg...@googlegroups.com.
Visit this group at https://groups.google.com/group/gg95.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "gg95" group.

To unsubscribe from this group and stop receiving emails from it, send an email to gg95+unsubscribe@googlegroups.com.


To post to this group, send email to gg...@googlegroups.com.
Visit this group at https://groups.google.com/group/gg95.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "gg95" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gg95/FulShiN5xy8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gg95+unsubscribe@googlegroups.com.

jfh

unread,
Feb 12, 2018, 6:23:26 PM2/12/18
to gg95


On Wednesday, January 31, 2018 at 1:05:19 AM UTC+13, darmar wrote:
"What are the advantages of Gfortran? "

G95 is not developed / actively maintained anymore
True but I still use it with other compilers because (a) its error messages may be easier to understand, or (b) it may find a bug that others miss, or (c) it may run a correct program faster. It's usually good on f2003 or earlier Fortran, but I have a list of 6 unfixed g95 bugs at http://homepages.ecs.vuw.ac.nz/~harper/g95bugs
Reply all
Reply to author
Forward
0 new messages