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 

Error in documentation of intrinsic function RANGE

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



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Sat Apr 09, 2022 9:05 pm    Post subject: Error in documentation of intrinsic function RANGE Reply with quote

The FTN95 documentation gives a definition of the the intrinsic RANGE that is not quite correct for arguments of type REAL.

The Fortran Standard says that RANGE(X) = INT (MIN (LOG10 (HUGE (X)), −LOG10 (TINY (X))))

For an X86/X64 processor 64-bit real, that evaluates to INT(Min(308.2, 307.6)) = 307, which agrees with the output for

Code:
     print *,range(1d0)


The FTN95 documentation says, "The result is a scalar integer giving the difference between the largest (positive) exponent and the smallest (largest negative) exponent that is used by the compiler for numbers of the given type and kind type." That would be 308 - (-307) = 615.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sun Apr 10, 2022 8:55 am    Post subject: Reply with quote

Thanks mecej4. I will make a note of 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 -> 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