soccer jersey forums.silverfrost.com :: View topic - HUGE for default REAL
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 

HUGE for default REAL

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



Joined: 07 Aug 2007
Posts: 29
Location: London or Somerset, UK

PostPosted: Tue Mar 04, 2008 1:03 pm    Post subject: HUGE for default REAL Reply with quote

According to the FTN95 help documentation, the value of HUGE for the default single precision REAL is 3.4028235E+38. Yet when I try to do
Code:
REAL aReal
aReal = 3.4028235E+38

the compiler says,

ERROR Floating point number out of range.

However,
Code:
aReal = HUGE(aReal)
seems to compile ok.

Also, I note that
Code:
DATA maxRl   / HUGE(maxRl)  /
appears to compile ok when it is in a BLOCK DATA subroutine. Shouldn�t the compiler flag this as illegal use of executable code within the block data.

Keith
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Mar 06, 2008 10:16 am    Post subject: Reply with quote

The compiler parses the constant as a REAL*10 and then tests it against HUGE(x). So what you observe is the effect of round-off error. That is 3.4028235E+38 (as a REAL*10) is greater than HUGE(x).

If you want to use an explicit constant then you must write 3.4028235E+38_2 or its equivalent.

In the DATA statement, HUGE(maxR1) is presumably converted to a constant by the compiler. In other words it does not represent executable code.

If you want FTN95 to be strictly standard conforming then you need to use /ISO on the command line. In this case /ISO does not flag a fault.

Since the DATA statement is old Fortran and HUGE is a new intrinsic, I would be surprised if the Standard had anything to say about this.
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