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 

Floating point co-processor fault at address <number>

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
pban92



Joined: 23 Nov 2009
Posts: 38

PostPosted: Tue Nov 30, 2010 5:44 pm    Post subject: Floating point co-processor fault at address <number> Reply with quote

The following declarations are provoking the error as shown in the post subject.

Code:
   
        REAL :: sum2,sum3,skewn
   INTEGER :: n
   DOUBLE PRECISION, DIMENSION(n) :: nvdata   
        DOUBLE PRECISION :: avg

        DO i = 1, n
   
        sum3 = sum3+(nvdata(i)-avg)**3
   skewn = (sum3/REAL(n))/((sum2/REAL(n))**(3/2))

   END DO


My assumption is if data type of "n" could be converted to "DOUBLE PRECISION(n)" instead of "REAL(n)", it could be solved.
Any comment/suggestion would be highly appreciated.


Thanks!
Back to top
View user's profile Send private message
DrTip



Joined: 01 Aug 2006
Posts: 74
Location: Manchester

PostPosted: Thu Dec 02, 2010 11:28 am    Post subject: Reply with quote

pban92

The code snippet you have posted is incomplete so difficult to say but

I think your problem is that sum2 and avg have not been initialised. (unless they are parameters passed to the subroutine)

I personally would not use REAL(n) since it is not required and obscures the reading of the code ( unless I am missing something) compiler will convert double precision / integer into a double precision but ...


as an aside

3/2 in power will yield 1 not 1.5 you need to use either 1.5 or use 3.0/2.0.

Carl
Back to top
View user's profile Send private message
pban92



Joined: 23 Nov 2009
Posts: 38

PostPosted: Thu Dec 02, 2010 2:39 pm    Post subject: Reply with quote

Thank you Carl. The error came from divided by zero from "sum2=0".
Your last suggestion was really helpful.

Cheers!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General 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