Sujet : Re: Angle Units For Trig Functions
De : sgk (at) *nospam* REMOVEtroutmask.apl.washington.edu (Steven G. Kargl)
Groupes : comp.lang.fortranDate : 20. Oct 2024, 06:35:25
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vf24qs$9mgr$1@dont-email.me>
References : 1
User-Agent : Pan/0.145 (Duplicitous mercenary valetism; d7e168a git.gnome.org/pan2)
On Sun, 20 Oct 2024 03:47:13 +0000, Lawrence D'Oliveiro wrote:
I see that the Fortran 2023 spec has added a bunch of parallel trig
functions that work in degrees.
No. Fortran does not contain "a bunch of parallel trig functions
that work in degrees." It contains a bunch of elemental functions.
I find this sort of thing unnecessary. It seems conventional to add
functions for converting between degrees and radians, but a simpler way is
to simply define a conversion factor for each angle unit. One conversion
factor is simpler than two functions for each angle unit.
program foo
real x, y
x = 30+360*1111
y = x * (4 * atan(1.) / 180)
print *, sind(x), sin(y)
end program foo
% gfcx -o z a.f90 && ./z
0.500000000 0.500089288
One of these values is exact, and one of these raises FE_INEXACT.
-- steve