forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Format statements

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Anonymous
Guest





PostPosted: Sat Sep 16, 2006 4:07 pm    Post subject: Format statements Reply with quote

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

PostPosted: Sun Sep 17, 2006 3:35 am    Post subject: Format statements Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7928
Location: Salford, UK

PostPosted: Mon Sep 18, 2006 1:03 am    Post subject: Format statements Reply with quote

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
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group