Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Steven G. Kargl" Newsgroups: comp.lang.fortran Subject: Re: Angle Units For Trig Functions Date: Thu, 24 Oct 2024 02:17:15 -0000 (UTC) Organization: A noiseless patient Spider Lines: 33 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 24 Oct 2024 04:17:15 +0200 (CEST) Injection-Info: dont-email.me; posting-host="2fcf8133e626c62d4ab5737bdf70a9bd"; logging-data="2472661"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Znh9LaTIkUb8mHc4fEoZZ" User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a git.gnome.org/pan2) Cancel-Lock: sha1:iW7MwuRgd9PlWIsC3BW7zj5pJMg= Bytes: 2306 On Wed, 23 Oct 2024 23:13:38 +0000, Lawrence D'Oliveiro wrote: > On Wed, 23 Oct 2024 16:38:41 -0600, Louis Krupp wrote: > >> Seriously, though, if you're interfacing with people, degrees are easier >> and more familiar than radians. > > But trig calculations are easier in radians. And it is easy to convert > back and forth, as I explained in the posting that started this thread. Easier? program foo real*8 x, y real*8, parameter :: deg2rad = 4 * atan(1.d0) / 180 x = 137*180 y = x * deg2rad print *, sind(x), sin(y) end program foo % gfcx -o z -Wall a.f90 && ./z -0.0000000000000000 -9.8590724568376608E-016 One of these values is wrong. For x = (n + 1) * 180 and n < 2**23, sind(x) = +-0, exactly. For y = x * pi / 180, sin(x) never equals +-0. You seem to be missing that argument reduction for sind(x) is much easier than argument reduction for sin(x). -- steve