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 

Fortran 2003 and 2008 features
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions
View previous topic :: View next topic  
Author Message
PaulLaidler
Site Admin


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

PostPosted: Tue May 28, 2019 2:40 pm    Post subject: Reply with quote

mecej4

Thanks for the information.
Back to top
View user's profile Send private message AIM Address
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Sat Jun 13, 2020 7:40 pm    Post subject: Reply with quote

This seemed like chronologically the best place to post this question ...

Are there any features of Fortran 2018 (yes apparently it's out of the box) that could be usefully incorporated into FTN95 as extensions ?
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
simon



Joined: 05 Jul 2006
Posts: 268

PostPosted: Fri Feb 12, 2021 12:16 am    Post subject: Intrinsic functions in declaration statements Reply with quote

The release notes for version 8.70 state:

Quote:
The Fortran 2003 feature that allows standard intrinsics in initialisation statements has been added


I am pleased to be using this feature, but note that INT and REAL are not yet permitted by FTN95. Are there any plans to add these?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Feb 12, 2021 8:57 am    Post subject: Reply with quote

simon

I guess that this was just an oversight. I will make a note of this omission.

Out of interest, can you illustrate this with code where these are useful?
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Fri Feb 12, 2021 2:20 pm    Post subject: Reply with quote

Paul,

Simon's post reminded me of this one. A colleague who uses another compiler came up with this, which does not work with FTN95:-

Code:
integer, parameter :: dp=kind(1.d0), n = 10
integer i
complex(kind=dp), dimension(1:10), parameter :: j_n = [ (cmplx(0.d0,i,kind=dp), i = 1, 10) ]   ! Not acceptable to FTN95, but OK with others
do i = 1, n
  print*, i, j_n(i)
end do
end


Their compiler produces:
Code:
           1               (0.0000000000000000,1.0000000000000000)
           2               (0.0000000000000000,2.0000000000000000)
           3               (0.0000000000000000,3.0000000000000000)
           4               (0.0000000000000000,4.0000000000000000)
           5               (0.0000000000000000,5.0000000000000000)
           6               (0.0000000000000000,6.0000000000000000)
           7               (0.0000000000000000,7.0000000000000000)
           8               (0.0000000000000000,8.0000000000000000)
           9               (0.0000000000000000,9.0000000000000000)
          10               (0.0000000000000000,10.000000000000000)


While FTN95 says:-

Code:
Error 172 - Constant expression expected
Compilation failed.
Back to top
View user's profile Send private message Visit poster's website
simon



Joined: 05 Jul 2006
Posts: 268

PostPosted: Fri Feb 12, 2021 5:20 pm    Post subject: Examples of Intrinsics in declaration statements Reply with quote

Many thanks Paul. Using this new feature, I am now defining various constants in the declarations, thus:

Code:
Module m
   Implicit None
   Intrinsic Epsilon, Huge, Kind, Sqrt, Tiny
!
   Integer, Parameter, Public :: rp = Kind(1.0d0) ! - double precision -
!
   Real(Kind=rp), Parameter, Public :: one = 1.0_rp ! - one -
!
   Integer, Parameter, Public :: ihuge = Huge(rp)               ! - huge integer -
!
   Real(Kind=rp), Parameter, Public :: rhuge = Huge(one)        ! - huge real -
   Real(Kind=rp), Parameter, Public :: eps = Epsilon(one)       ! - machine precision -
   Real(Kind=rp), Parameter, Public :: sfmin = Tiny(one)        ! - safe minimum -
   Real(Kind=rp), Parameter, Public :: sfmax = one/sfmin        ! - safe maximum -
   Real(Kind=rp), Parameter, Public :: smlnum = Sqrt(sfmin)/eps ! - small number -
   Real(Kind=rp), Parameter, Public :: bignum = one/smlnum      ! - big number -
   Real(Kind=rp), Parameter, Public :: tol = Sqrt(eps)          ! - tolerance -
End Module m

It would be nice to add the following:
Code:
   Real(Kind=rp), Parameter, Public :: base = Real(Radix(one), Kind=rp) ! - base -
   Real(Kind=rp), Parameter, Public :: bt = base**(Digits(one) - 1)     ! - machine precision -
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Feb 13, 2021 9:19 am    Post subject: Reply with quote

Simon and Ken

Thank you for the information.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Mon Feb 15, 2021 12:15 pm    Post subject: Reply with quote

The use of REAL in an initialisation expression will be permitted in the next release of FTN95.

Unfortunately allowing cmplx in an initialisation expression with array constructor would involve a disproportional amount of work. So for the time being at least it will be necessary to change the code to...

Code:
complex(kind=dp), dimension(1:10):: j_n
j_n = [ (cmplx(0.d0,i), i = 1, 10) ]
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Mon Feb 15, 2021 2:43 pm    Post subject: Reply with quote

Paul, Thanks for the feedback, I know to avoid this construction (for now).
Back to top
View user's profile Send private message Visit poster's website
simon



Joined: 05 Jul 2006
Posts: 268

PostPosted: Mon Feb 15, 2021 9:35 pm    Post subject: Reply with quote

Many thanks, Paul. Will INT also be available?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Feb 16, 2021 9:31 am    Post subject: Reply with quote

Simon

It seemed to me that INT was already available. If not can you provide a sample.
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 268

PostPosted: Tue Feb 16, 2021 6:04 pm    Post subject: Reply with quote

Hi Paul, INT does not appear to be working. As long as you do not ask me to remember why I am using this particular equation(!), here is an example:

Code:
   Real(Kind=rp), Parameter, Public :: elim = Real(Int(0.693_rp*MaxExponent(one)), Kind=rp)


where "one" is previously defined as a Real(Kind=rp) parameter, 1.0_rp
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Feb 17, 2021 10:42 am    Post subject: Reply with quote

Simon

This has now been fixed for the next release of FTN95.
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 268

PostPosted: Tue Aug 10, 2021 11:23 pm    Post subject: Reply with quote

I have just tried to compile LAPACK 3.10.0 and get an error message about FLOOR and CEILING not being permitted in initialization. Paul kindly enabled a few intrinsic functions to be used in initialization. May I add these to his in tray?
Many thanks,
Simon
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Aug 11, 2021 7:27 am    Post subject: Reply with quote

Thanks Simon. I have logged this for investigation.
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 -> Suggestions All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
Page 3 of 10

 
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