View previous topic :: View next topic |
Author |
Message |
Anonymous Guest
|
Posted: Sat Sep 16, 2006 4:07 pm Post subject: Format statements |
|
|
My variable x is double precision. (ex: x=3.87768554688)
I want write it with 6 digits after the decimal and do not use scientific notation.
I have tried format (F8.6). But it gives this message:
Error 51: Format/ data mismatch
What should I use to write x with 6 digits after the decimal and do not use scientific notation.
write(*, 900) x
900 format (????)
x=3.877685
livia
email: lilimacarrao@hotmail.com
Livia |
|
Back to top |
|
|
MERO
Joined: 25 Apr 2006 Posts: 41 Location: Wuerzburg, Germany
|
Posted: Sun Sep 17, 2006 3:35 am Post subject: Format statements |
|
|
Hi
try using f10.6 or f12.6 or more, depending on what number you have
If you use F8.6 you can only write numbers with 1 digit before the decimal ( e.g. 4.123456 )
If you try to write e.g. 12.123456 or -3.123456 you will get this error.
Klaus |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Mon Sep 18, 2006 1:03 am Post subject: Format statements |
|
|
Livia
Although Klaus is correct in saying that you should allow enough characters in the field width, failure to do so does not cause this runtime error.
The following code is "successful" but outputs a row of stars...
real(2) x
x = 2222222.122344
write(*,900)x
900 format(f8.6)
end
A data mismatch would occur if, for example, you declared x as an INTEGER. |
|
Back to top |
|
|
|