View previous topic :: View next topic |
Author |
Message |
Kenneth_Smith
Joined: 18 May 2012 Posts: 809 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Fri May 16, 2025 8:58 am Post subject: Fortran 2023 trig functions |
|
|
The fortran 2023 standard includes new trig related functions, namely cosd, sind, tand, acosd, asind, atand, atan2d, acospi, asinpi, atanpi, atan2pi, cospi, sinpi, and tanpi.
**D functions which use degrees rather than radians were implemented in gFortran and Ifort as extensions long before the 2023 standard, so they do appear fairly regularly in code I see written by others.
**PI functions operate on multiples of half revolutions. For example:: COSPI(x) = COS(PI*X), so COSPI(1.0) = -1.0 These functions have obvious applications in signal processing etc.
Perhaps these new intrinsics should be added to the FTN95 wish list, and added to the library when time permits? This would keep the core mathematical intrinsics in FTN95 in synch with the latest fortran standard.
The functions should be easy to implement - no gotchas like asin(Z)
Further details can be found here:
https://wg5-fortran.org/N2201-N2250/N2212.pdf |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8201 Location: Salford, UK
|
Posted: Sat May 17, 2025 6:46 am Post subject: |
|
|
Many thanks for the feedback. I have added this to the wish list. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8201 Location: Salford, UK
|
Posted: Thu Jun 05, 2025 8:24 am Post subject: |
|
|
These functions have now been implemented for the next release of FTN95 and the associated DLLs. |
|
Back to top |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 1257 Location: Morrison, CO, USA
|
Posted: Thu Jun 05, 2025 1:54 pm Post subject: |
|
|
Paul, this will be a nice addition. I have some complex equations that will be simplified (to the eye, at least) using these new features.
Thanks for all you do! |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8201 Location: Salford, UK
|
Posted: Thu Jun 05, 2025 5:04 pm Post subject: |
|
|
Bill
If "complex" means passing and returning complex numbers then this addition will not help.
As I understand it, the Standard does not include complex numbers in this context. Please let me know if I am wrong. |
|
Back to top |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 1257 Location: Morrison, CO, USA
|
Posted: Thu Jun 05, 2025 11:17 pm Post subject: |
|
|
Oh, sorry! I "misspoke". I meant that there are a number of calculations that would be better done using *D or *PI functions, making the reading of them simpler, versus complex. Mostly involving spherical trig and datum conversions...
I can certainly see using that term would cause some concern! |
|
Back to top |
|
 |
Kenneth_Smith
Joined: 18 May 2012 Posts: 809 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Fri Jun 06, 2025 8:23 am Post subject: |
|
|
Good work Paul, I appreciate this addition to the library.
Just to clarify, the aforementioned functions are indeed intended to operate on real and not complex variables. |
|
Back to top |
|
 |
|