Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Kirk to Enterprise -- beam down yeoman Rand and a six-pack.


devel / comp.lang.c / Radians Or Degrees?

SubjectAuthor
* Radians Or Degrees?Lawrence D'Oliveiro
+* Re: Radians Or Degrees?James Kuyper
|`* Re: Radians Or Degrees?Michael S
| `* Re: Radians Or Degrees?Lawrence D'Oliveiro
|  `* Re: Radians Or Degrees?Steven G. Kargl
|   `* Re: Radians Or Degrees?Lawrence D'Oliveiro
|    `* Re: Radians Or Degrees?Steven G. Kargl
|     `* Re: Radians Or Degrees?Lawrence D'Oliveiro
|      +* Re: Radians Or Degrees?Michael S
|      |+- Re: Radians Or Degrees?Lawrence D'Oliveiro
|      |+* Re: Radians Or Degrees?MitchAlsup1
|      ||`* Re: Radians Or Degrees?Steven G. Kargl
|      || +* Re: Radians Or Degrees?Chris M. Thomasson
|      || |`* Re: Radians Or Degrees?Chris M. Thomasson
|      || | `* Re: Radians Or Degrees?MitchAlsup1
|      || |  `* Re: Radians Or Degrees?Chris M. Thomasson
|      || |   `* Re: Radians Or Degrees?Lawrence D'Oliveiro
|      || |    `* Re: Radians Or Degrees?Chris M. Thomasson
|      || |     `* Re: Radians Or Degrees?Lawrence D'Oliveiro
|      || |      `* Re: Radians Or Degrees?Chris M. Thomasson
|      || |       +- Re: Radians Or Degrees?Lawrence D'Oliveiro
|      || |       `- Re: Radians Or Degrees?Chris M. Thomasson
|      || +* Re: Radians Or Degrees?MitchAlsup1
|      || |`* Re: Radians Or Degrees?Terje Mathisen
|      || | `* Re: Radians Or Degrees?Michael S
|      || |  +* Re: Radians Or Degrees?MitchAlsup1
|      || |  |+* Re: Radians Or Degrees?MitchAlsup1
|      || |  ||`- Re: Radians Or Degrees?Terje Mathisen
|      || |  |+* Re: Radians Or Degrees?Lawrence D'Oliveiro
|      || |  ||+- Re: Radians Or Degrees?Chris M. Thomasson
|      || |  ||`* Re: Radians Or Degrees?MitchAlsup1
|      || |  || `* Re: Radians Or Degrees?Chris M. Thomasson
|      || |  ||  `- Re: Radians Or Degrees?Chris M. Thomasson
|      || |  |`- Re: Radians Or Degrees?Michael S
|      || |  +* Re: Radians Or Degrees?Terje Mathisen
|      || |  |+* Re: Radians Or Degrees?Michael S
|      || |  ||`* Re: Radians Or Degrees?MitchAlsup1
|      || |  || `- Re: Radians Or Degrees?Terje Mathisen
|      || |  |`* Re: Radians Or Degrees?Chris M. Thomasson
|      || |  | +* Re: Radians Or Degrees?Chris M. Thomasson
|      || |  | |`- Re: Radians Or Degrees?Chris M. Thomasson
|      || |  | +* Re: Radians Or Degrees?Keith Thompson
|      || |  | |+* Re: Radians Or Degrees?Chris M. Thomasson
|      || |  | ||`* Re: Radians Or Degrees?Chris M. Thomasson
|      || |  | || `* Re: Radians Or Degrees?Keith Thompson
|      || |  | ||  `* Re: Radians Or Degrees?Chris M. Thomasson
|      || |  | ||   `- Re: Radians Or Degrees?Chris M. Thomasson
|      || |  | |`* Re: Radians Or Degrees?MitchAlsup1
|      || |  | | `* Re: Radians Or Degrees?Michael S
|      || |  | |  `* Re: Radians Or Degrees?MitchAlsup1
|      || |  | |   +- Re: Radians Or Degrees?Scott Lurndal
|      || |  | |   +- Re: Radians Or Degrees?Michael S
|      || |  | |   `* Re: Radians Or Degrees?Keith Thompson
|      || |  | |    +* Re: Radians Or Degrees?bart
|      || |  | |    |`* Re: Radians Or Degrees?Keith Thompson
|      || |  | |    | `* Re: Radians Or Degrees?bart
|      || |  | |    |  `* Re: Radians Or Degrees?Keith Thompson
|      || |  | |    |   `- Re: Radians Or Degrees?David Brown
|      || |  | |    `* Re: Radians Or Degrees?Michael S
|      || |  | |     +- Re: Radians Or Degrees?Michael S
|      || |  | |     `* Re: Radians Or Degrees?bart
|      || |  | |      `- Re: Radians Or Degrees?Michael S
|      || |  | `- Re: Radians Or Degrees?Chris M. Thomasson
|      || |  `* Re: Radians Or Degrees?Stefan Monnier
|      || |   `* Re: Radians Or Degrees?MitchAlsup1
|      || |    `* Re: Radians Or Degrees?Stefan Monnier
|      || |     +* Re: Radians Or Degrees?Michael S
|      || |     |+* Re: Radians Or Degrees?Stefan Monnier
|      || |     ||`* Re: Radians Or Degrees?MitchAlsup1
|      || |     || `* Re: Radians Or Degrees?Terje Mathisen
|      || |     ||  `* Re: Radians Or Degrees?Michael S
|      || |     ||   +- Re: Radians Or Degrees?MitchAlsup1
|      || |     ||   `- Re: Radians Or Degrees?Terje Mathisen
|      || |     |+* Re: Radians Or Degrees?Steven G. Kargl
|      || |     ||`- Re: Radians Or Degrees?MitchAlsup1
|      || |     |`* Re: Radians Or Degrees?MitchAlsup1
|      || |     | `- Re: Radians Or Degrees?Michael S
|      || |     +* Re: Radians Or Degrees?MitchAlsup1
|      || |     |`- Re: Radians Or Degrees?Stefan Monnier
|      || |     `- Re: Radians Or Degrees?Terje Mathisen
|      || `* Re: Radians Or Degrees?Michael S
|      ||  `* Re: Radians Or Degrees?MitchAlsup1
|      ||   `* Re: Radians Or Degrees?Steven G. Kargl
|      ||    +* Re: Radians Or Degrees?MitchAlsup1
|      ||    |+* Re: Radians Or Degrees?Lawrence D'Oliveiro
|      ||    ||`* Re: Radians Or Degrees?Steven G. Kargl
|      ||    || +* Re: Radians Or Degrees?Lawrence D'Oliveiro
|      ||    || |`* Re: Radians Or Degrees?Steven G. Kargl
|      ||    || | `- Re: Radians Or Degrees?Kaz Kylheku
|      ||    || `* Re: Radians Or Degrees?Lawrence D'Oliveiro
|      ||    ||  `* Re: Radians Or Degrees?Steven G. Kargl
|      ||    ||   `- Re: Radians Or Degrees?MitchAlsup1
|      ||    |`- Re: Radians Or Degrees?Steven G. Kargl
|      ||    +* Re: Radians Or Degrees?Lawrence D'Oliveiro
|      ||    |+* Re: Radians Or Degrees?Ben Bacarisse
|      ||    ||`* Re: Radians Or Degrees?Lawrence D'Oliveiro
|      ||    || `* Re: Radians Or Degrees?Ben Bacarisse
|      ||    ||  +* Re: Radians Or Degrees?Lawrence D'Oliveiro
|      ||    ||  |`* Re: Radians Or Degrees?Ben Bacarisse
|      ||    ||  | +* Re: Radians Or Degrees?Kaz Kylheku
|      ||    ||  | |`* Re: Radians Or Degrees?Ben Bacarisse
|      ||    ||  | `* Re: Radians Or Degrees?Lawrence D'Oliveiro
|      ||    ||  `- Re: Radians Or Degrees?Tim Rentsch
|      ||    |+- Re: Radians Or Degrees?Kaz Kylheku
|      ||    |`* Re: Radians Or Degrees?James Kuyper
|      ||    `* Re: Radians Or Degrees?Terje Mathisen
|      |`- Re: Radians Or Degrees?Terje Mathisen
|      `* Re: Radians Or Degrees?Steven G. Kargl
+* Re: Radians Or Degrees?fir
+* Re: Radians Or Degrees?Malcolm McLean
+- Re: Radians Or Degrees?David Brown
`* Re: Radians Or Degrees?Blue-Maned_Hawk

Pages:1234567
Radians Or Degrees?

<ur5trn$3d64t$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33648&group=comp.lang.c#33648

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Radians Or Degrees?
Date: Wed, 21 Feb 2024 22:35:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <ur5trn$3d64t$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 21 Feb 2024 22:35:35 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="01b911325e9528685287d2bc56fa86ff";
logging-data="3578013"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/jjJSgAGQbr2jQMGkUf1So"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:cXFhmLA2CRsJ8WQUDwk2Hc4Frtc=
 by: Lawrence D'Oliv - Wed, 21 Feb 2024 22:35 UTC

What units should be used for angles in trig functions?

Radians are the most natural unit for most trig calculations, and that’s
what the library routines in C and many other languages use. However,
degrees are a more natural unit for humans to input, and to get results
in.

Thus, other languages, but not (yet?) C, provide conversion functions. For
example, Python has math.radians() for converting degrees to radians, and
math.degrees() for going the other way. Java has something similar.

But I think providing conversion functions is an unnecessarily clumsy way
of doing it, because for every alternative angle unit, you need two
functions.

Better to provide just a single conversion factor. E.g.

DEG = π / 180

Now it is easy enough to input angles to a calculation in degrees, e.g.

sin(45 * DEG)

And getting outputs in degrees is equally easy, e.g.

atan2(Y, X) / DEG

Sometimes it is convenient to work in terms of whole circles (360°):

CIRCLE = 2 * π

Thus the examples become:

sin(CIRCLE / 8)

and

atan2(Y, X) / CIRCLE

Anybody remember “gradians”?

GRAD = π / 200

And of course, for completeness, we can have a factor for explicitly
specifying that you are working radians:

RAD = 1.0

Re: Radians Or Degrees?

<ur5v05$3ccut$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33649&group=comp.lang.c#33649

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Wed, 21 Feb 2024 17:55:01 -0500
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <ur5v05$3ccut$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Feb 2024 22:55:03 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f679441fdf6cd96c59400d664f91e949";
logging-data="3552221"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Q/jH6VrIhlL/S+WOamNOAND8vae5Blvo="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:MpLBMDJAVNlqzWHRgAWFePYfrY0=
In-Reply-To: <ur5trn$3d64t$1@dont-email.me>
Content-Language: en-US
 by: James Kuyper - Wed, 21 Feb 2024 22:55 UTC

On 2/21/24 17:35, Lawrence D'Oliveiro wrote:
> What units should be used for angles in trig functions?

The standard specifies that sin, cos, and tan() take arguments measured
in radians. Degrees are mentioned only in the context of the complex
versions of the trig functions, and only for the purpose of mentioning
that they do NOT take arguments in degrees.

Re: Radians Or Degrees?

<ur605r$3fe50$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33650&group=comp.lang.c#33650

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 00:15:47 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <ur605r$3fe50$1@i2pn2.org>
References: <ur5trn$3d64t$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 21 Feb 2024 23:15:07 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3651744"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
In-Reply-To: <ur5trn$3d64t$1@dont-email.me>
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: fir - Wed, 21 Feb 2024 23:15 UTC

Lawrence D'Oliveiro wrote:
> What units should be used for angles in trig functions?
>
> Radians are the most natural unit for most trig calculations, and that’s
> what the library routines in C and many other languages use. However,
> degrees are a more natural unit for humans to input, and to get results
> in.
>
> Thus, other languages, but not (yet?) C, provide conversion functions. For
> example, Python has math.radians() for converting degrees to radians, and
> math.degrees() for going the other way. Java has something similar.
>
> But I think providing conversion functions is an unnecessarily clumsy way
> of doing it, because for every alternative angle unit, you need two
> functions.
>
> Better to provide just a single conversion factor. E.g.
>
> DEG = π / 180
>
> Now it is easy enough to input angles to a calculation in degrees, e.g.
>
> sin(45 * DEG)
>
> And getting outputs in degrees is equally easy, e.g.
>
> atan2(Y, X) / DEG
>
> Sometimes it is convenient to work in terms of whole circles (360°):
>
> CIRCLE = 2 * π
>
> Thus the examples become:
>
> sin(CIRCLE / 8)
>
> and
>
> atan2(Y, X) / CIRCLE
>
> Anybody remember “gradians”?
>
> GRAD = π / 200
>
> And of course, for completeness, we can have a factor for explicitly
> specifying that you are working radians:
>
> RAD = 1.0
>

long time i think it should be measured in what you call here circle,
it is rather in "1" not in "360" nor "2PI" ..in my coding hovevver i use
degree360 = 2*PI/360.0

this what you call circle imo wpuld be better and i doubt in a reason to
use PI in mathematics yet defien it as 3.14 instead of 6.28 here if this
value is really needed

also on assembly level i would like if fsin arguments woyld be not on
radians but in "1.0" floats

if someone knows the reason why "6.28" radians are expected to better
than "1.0" 'circkles' in both mathemathics and assembly tell me
- as i dont know the reason

Re: Radians Or Degrees?

<20240222015920.00000260@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33651&group=comp.lang.c#33651

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 01:59:20 +0200
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <20240222015920.00000260@yahoo.com>
References: <ur5trn$3d64t$1@dont-email.me>
<ur5v05$3ccut$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="559df66cb8659c1930c85fc4e7abe7f7";
logging-data="3557464"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/O0wyD/kzA0hkiK4/lGLYe5G/thubxPj0="
Cancel-Lock: sha1:KAACu7v0uKBRD/NYrJqpII9Z05g=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
 by: Michael S - Wed, 21 Feb 2024 23:59 UTC

On Wed, 21 Feb 2024 17:55:01 -0500
James Kuyper <jameskuyper@alumni.caltech.edu> wrote:

> On 2/21/24 17:35, Lawrence D'Oliveiro wrote:
> > What units should be used for angles in trig functions?
>
> The standard specifies that sin, cos, and tan() take arguments
> measured in radians. Degrees are mentioned only in the context of the
> complex versions of the trig functions, and only for the purpose of
> mentioning that they do NOT take arguments in degrees.
>

The latest version of IEEE-754 Standard (or, may be, the one that is
still in preparation? I don't remember), specifiies additional set of
trig routines for which argument=1.0 corresponds to 180 degrees (pi
Radians). The names are SinPi, CosPi etc...
I find this choice somewhat less logical than 1.0 corresponding to 360
degrees, but that's a matter of personal taste.

Re: Radians Or Degrees?

<ur69i3$3ftgj$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33653&group=comp.lang.c#33653

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 01:55:15 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <ur69i3$3ftgj$2@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur605r$3fe50$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 01:55:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0628152959bd9fc4f57a17e17cabba1f";
logging-data="3667475"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19gR72gDX+oBd+sp9E0MBfz"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:X7X7k1D1D/nbRDLzGnO574zugS4=
 by: Lawrence D'Oliv - Thu, 22 Feb 2024 01:55 UTC

On Thu, 22 Feb 2024 00:15:47 +0100, fir wrote:

> if someone knows the reason why "6.28" radians are expected to better
> than "1.0" 'circkles' in both mathemathics and assembly tell me - as i
> dont know the reason

It’s because trig calculations are most naturally done in radians. E.g.
the approximation

sin x ≅ tan x ≅ x as x → 0

works only if x is in radians. Also the Euler identity

ix
e = cos x + i sin x

only holds if x is in radians. And so on and so on.

Re: Radians Or Degrees?

<ur69j9$3ftgj$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33654&group=comp.lang.c#33654

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 01:55:54 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <ur69j9$3ftgj$3@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 01:55:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0628152959bd9fc4f57a17e17cabba1f";
logging-data="3667475"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18dnG1Mn67RKVY10lHY3N3q"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:ia22zxhmSgx+PmTrF9swQhKTBRY=
 by: Lawrence D'Oliv - Thu, 22 Feb 2024 01:55 UTC

On Thu, 22 Feb 2024 01:59:20 +0200, Michael S wrote:

> The latest version of IEEE-754 Standard (or, may be, the one that is
> still in preparation? I don't remember), specifiies additional set of
> trig routines for which argument=1.0 corresponds to 180 degrees (pi
> Radians). The names are SinPi, CosPi etc...
> I find this choice somewhat less logical than 1.0 corresponding to 360
> degrees, but that's a matter of personal taste.

Also quite unnecessary to invent a whole set of parallel functions just
for a different angle unit.

Re: Radians Or Degrees?

<ur6sdt$3nqtd$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33655&group=comp.lang.c#33655

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 07:17:17 +0000
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <ur6sdt$3nqtd$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 22 Feb 2024 07:17:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="581488e16e21ce826bd29e13c08fd0d8";
logging-data="3926957"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/vu0YgrgRylghY/eXG3q+5LksblLDOJuw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:EQ3aG7yF2vKif/Mpce0jU24Awkw=
In-Reply-To: <ur5trn$3d64t$1@dont-email.me>
Content-Language: en-GB
 by: Malcolm McLean - Thu, 22 Feb 2024 07:17 UTC

On 21/02/2024 22:35, Lawrence D'Oliveiro wrote:
> What units should be used for angles in trig functions?
>
The derivative of the sine is the cosine and vice versa, but only if you
measure in radians. And for some mathematical calculations this is an
important property, and so you really must use radians. And so if we
wish to support that type of mathematics with C, we must provide
functions which take radians.

--
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm

Re: Radians Or Degrees?

<ur6vau$3or1l$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33656&group=comp.lang.c#33656

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 09:06:54 +0100
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <ur6vau$3or1l$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 08:06:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="662507d08800df18b137a15a3ff7b4f5";
logging-data="3959861"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/T10woJBAGWjUz+gFF/6+TEOdU2afTstQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:Wf+IheVZGjoID54FWYgdpvxAQP8=
Content-Language: en-GB
In-Reply-To: <ur5trn$3d64t$1@dont-email.me>
 by: David Brown - Thu, 22 Feb 2024 08:06 UTC

On 21/02/2024 23:35, Lawrence D'Oliveiro wrote:
> What units should be used for angles in trig functions?
>
> Radians are the most natural unit for most trig calculations, and that’s
> what the library routines in C and many other languages use. However,
> degrees are a more natural unit for humans to input, and to get results
> in.
>
> Thus, other languages, but not (yet?) C, provide conversion functions. For
> example, Python has math.radians() for converting degrees to radians, and
> math.degrees() for going the other way. Java has something similar.
>
> But I think providing conversion functions is an unnecessarily clumsy way
> of doing it, because for every alternative angle unit, you need two
> functions.
>
> Better to provide just a single conversion factor. E.g.
>
> DEG = π / 180
>
> Now it is easy enough to input angles to a calculation in degrees, e.g.
>
> sin(45 * DEG)
>
> And getting outputs in degrees is equally easy, e.g.
>
> atan2(Y, X) / DEG >
> Sometimes it is convenient to work in terms of whole circles (360°):
>
> CIRCLE = 2 * π
>
> Thus the examples become:
>
> sin(CIRCLE / 8)
>
> and
>
> atan2(Y, X) / CIRCLE
>
> Anybody remember “gradians”?
>
> GRAD = π / 200
>
> And of course, for completeness, we can have a factor for explicitly
> specifying that you are working radians:
>
> RAD = 1.0

This all sounds reasonable to me. I would not bother with GRAD unless
you are writing code for the French military - despite being common on
calculators for a while, it's extremely rare to see it in use.

If you want a third unit, I'd pick the "Furman", scale factor 2π / 2^16.
It's the kind of thing you see in embedded systems where you want to
do your trig with fixed point numbers, integers, table lookups, splines,
etc., rather than floating point and slow, unnecessarily accurate
library functions. But it's not so common to see the name, and the
power of two is not always 16.

Maybe just TURN = 2π would be more useful?

Re: Radians Or Degrees?

<pan$d0f42$eeb000fb$9b95dafc$a5a80129@invalid.invalid>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33657&group=comp.lang.c#33657

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.samoylyk.net!nyheter.lysator.liu.se!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!bluemanedhawk.eternal-september.org!.POSTED!not-for-mail
From: bluemane...@invalid.invalid (Blue-Maned_Hawk)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 08:27:33 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <pan$d0f42$eeb000fb$9b95dafc$a5a80129@invalid.invalid>
References: <ur5trn$3d64t$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 08:27:33 -0000 (UTC)
Injection-Info: bluemanedhawk.eternal-september.org; posting-host="88d251291de5029efdde01ad7d49bf21";
logging-data="3969323"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Eer1XPAjmU/qu+JiN6nsFcS/mjaBXdwA="
User-Agent: Pan/0.154 (Izium; 517acf4)
Cancel-Lock: sha1:db8zNRHGXujzaPa91xd2S7D1+Q8=
X-Face: Llanfair­pwllgwyng
yll
­gogeryÂÃ
? ?­chwyrnÂÂÂÂÂÂ
­drobwll­llanÃ
‚Ã
ƒƒƒ‚­tysilioÂÂÂÃ
‚­gogo­goch
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACh0lEQVRYw71Z21bD
MAzzevbfkr4cHjrSXJyL044+MDa6WLEl2SkvkrZ1AbAvXO+bUGSCPYnsuIVGMpm
ZLnjX718GhAKNsp8lON2F9VrhELwIgJlBepkZjA78rVK+FkmNhEJK76UsJlz8+E
rJsjrpYouhLo/SC6qPHgakFOR8wV9+8rCfO/I/oVnmUZUp42/LW2XkLj9TCFNM9
jp5g2EmHZgpYZjCOkYU7sXVogRylJqpdggoFLG1g09Flah/7kErCxzR9HgXPYsq
0glb9cxjIz2Vsk9AmAoCSxECpD713joMKjQqLAtmMqJmXjdVvlMnMQCVITotJd1
z+fh1f1NNo+vuc1KnhWUmY7t03vydTud9BbXCtN3L2PL3bK7JCNG0GHzuZxafyB
fxevCxpm1vrwZltqw6SILCcdoCE6PGQC8wZWDA9Or7Qp5s3lAZezys0nDazs9S9
R0TjwEiksRxLkNPC1NMMWPs1bj0Ei0Yuo+JVtFLuzP1NRJ16qXWN8DhhtmS4PDg
O6mqRxs4bEJrYt087mSIow/1VzW2oFlMQuiuIy/KsUagvhdw6hSjJGlIavbLF8x
j3X47bccLcUSi0dkWh1nUZNhANT1tHKUXrNxNLbd9KPb9wDDVrKwmPQMOPQ1oy6
k5I1DwzDeRJd3jVIhDAUxq3ngzJG4CCkNXZxZVMcjefoK2J0gUY2S3rxz/RuTFx
2zHd9U+obimJXMG4edsk/2j5pTU5G1MmzbRLxkfq5EiT1GGsidvMGzi+1goGb2l
GCrN+nGnV8xj3q3JLRDVPL96vUc7Z4aJ3TN1mVqWAMJMfG+Jxh6TQqP+92iZkCU
xtglds1AB6r0aiSHKcnFck+p/c/0CbacFLQcajGcAAAAASUVORK5CYII=
 by: Blue-Maned_Hawk - Thu, 22 Feb 2024 08:27 UTC

Radians is the only angle unit which is not arbitrary.

--
Blue-Maned_Hawk│shortens to
Hawk│/
blu.mɛin.dÊ°ak/
│he/him/his/himself/Mr.
blue-maned_hawk.srht.site
Skylights: Trepanning for houses

Re: Radians Or Degrees?

<ur70r5$3pa74$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33658&group=comp.lang.c#33658

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.bbs.nz!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 09:32:37 +0100
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <ur70r5$3pa74$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur605r$3fe50$1@i2pn2.org>
<ur69i3$3ftgj$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 08:32:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="662507d08800df18b137a15a3ff7b4f5";
logging-data="3975396"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+VcrvxFkk6lIccMMGFMwCSBtTVw1D5inc="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:kfC/Zftxlkj2+12nRBfZ6uoLG+8=
In-Reply-To: <ur69i3$3ftgj$2@dont-email.me>
Content-Language: en-GB
 by: David Brown - Thu, 22 Feb 2024 08:32 UTC

On 22/02/2024 02:55, Lawrence D'Oliveiro wrote:
> On Thu, 22 Feb 2024 00:15:47 +0100, fir wrote:
>
>> if someone knows the reason why "6.28" radians are expected to better
>> than "1.0" 'circkles' in both mathemathics and assembly tell me - as i
>> dont know the reason
>
> It’s because trig calculations are most naturally done in radians. E.g.
> the approximation
>
> sin x ≅ tan x ≅ x as x → 0
>
> works only if x is in radians. Also the Euler identity
>
> ix
> e = cos x + i sin x
>
> only holds if x is in radians. And so on and so on.

From a mathematical standpoint, clearly radians are a far more natural
choice of unit than anything else for trig. But it is not as certain
that they are a good choice for programming.

For implementing "sin", you first have to reduce the value modulo 2π. I
would have thought it would easier to do that if the units were turns,
as the modulo reduction would then simply be taking the fractional part
of the number. You may also want to reduce to a 0°-90°, or 0-π/2 range
for the main calculation.

If you are doing with main calculation by Taylor series, radians are the
nicest units. But I believe it is more common to use Chebyshev
polynomials, and for that there is no great advantage in radians. It's
a very long time since I looked at Chebyshevs, but I think your most
efficient method would be to map 0°-90° to the range -1 to 1 - i.e.,
centred around 45°. This brings you to an ideal unit of an eighth of a
turn.

Turns divided by some power of two would also be ideal for faster but
less accurate implementations, such as Cordic or tables with linear or
cubic interpolation.

From the user viewpoint, radians are a natural unit for a lot of
applications - as are degrees. Turns, or turns divided by a power of
two, are also very useful for many applications, but there is no
consensus about what power of two to use.

And the user viewpoint is the important one here - the value can be
scaled before doing the calculations.

So choice number one for programming languages should be radians, except
perhaps for languages aimed at beginners or kids, where degrees might be
more appropriate. And if you have a second set, degrees would be the
choice, then followed by turns. (Half turns - SinPi and CosPi - seems
odd to me.)

Re: Radians Or Degrees?

<ur74nd$3q27m$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33659&group=comp.lang.c#33659

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 09:38:52 +0000
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <ur74nd$3q27m$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur605r$3fe50$1@i2pn2.org>
<ur69i3$3ftgj$2@dont-email.me> <ur70r5$3pa74$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 09:38:53 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="581488e16e21ce826bd29e13c08fd0d8";
logging-data="3999990"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qAL0qSOHYwHdD76CsKmDsoVgxvb5D9dw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:FSziGigKhQX5khHiDx1GMpkTwdg=
In-Reply-To: <ur70r5$3pa74$1@dont-email.me>
Content-Language: en-GB
 by: Malcolm McLean - Thu, 22 Feb 2024 09:38 UTC

On 22/02/2024 08:32, David Brown wrote:
>
> For implementing "sin", you first have to reduce the value modulo 2π.

For an efficient implentation yes. But applying the formula to values
outside the range of 0 - 2PI also produces the correct result if you go
on for long enough.

--
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm

Re: Radians Or Degrees?

<ur7675$3qbhl$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33660&group=comp.lang.c#33660

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 11:04:20 +0100
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <ur7675$3qbhl$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur605r$3fe50$1@i2pn2.org>
<ur69i3$3ftgj$2@dont-email.me> <ur70r5$3pa74$1@dont-email.me>
<ur74nd$3q27m$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 10:04:21 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="662507d08800df18b137a15a3ff7b4f5";
logging-data="4009525"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ZMNrgoTQiHw2VVa7ilhjiTOPYxp5luxo="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:ZWP0ncfNwGO/7Klk9/9nEwT8Pi4=
Content-Language: en-GB
In-Reply-To: <ur74nd$3q27m$1@dont-email.me>
 by: David Brown - Thu, 22 Feb 2024 10:04 UTC

On 22/02/2024 10:38, Malcolm McLean wrote:
> On 22/02/2024 08:32, David Brown wrote:
>>
>> For implementing "sin", you first have to reduce the value modulo 2π.
>
> For an efficient implentation yes. But applying the formula to values
> outside the range of 0 - 2PI also produces the correct result if you go
> on for long enough.
>

Assuming that "the formula" you are referring to is one of the infinite
polynomials for sin, then yes - I think anyone who knows about such
maths will be aware of that. However, it is pretty much entirely
irrelevant in the context of computing values for trig functions.

Re: Radians Or Degrees?

<ur76he$3qbhl$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33661&group=comp.lang.c#33661

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 11:09:50 +0100
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <ur76he$3qbhl$2@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me>
<pan$d0f42$eeb000fb$9b95dafc$a5a80129@invalid.invalid>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 22 Feb 2024 10:09:50 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="662507d08800df18b137a15a3ff7b4f5";
logging-data="4009525"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Os1EEZk+kPk5msD7KRgD0HKj1jn4hjXE="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:wYse/2UdHWstbAfxhPR43Y3PIGE=
Content-Language: en-GB
In-Reply-To: <pan$d0f42$eeb000fb$9b95dafc$a5a80129@invalid.invalid>
 by: David Brown - Thu, 22 Feb 2024 10:09 UTC

On 22/02/2024 09:27, Blue-Maned_Hawk wrote:
>
> Radians is the only angle unit which is not arbitrary.
>
>

No, it is not. "Turns" are also not arbitrary, and are also
mathematically fundamental.

And while degrees were created by people, rather than something
fundamental in the mathematics, the number of divisions was picked
carefully for particular properties (lots of divisors). And since
degrees are a well-established and commonly known angle unit, using them
is not arbitrary. Even gradians were defined that way for good reasons.
So these units are not arbitrary - even though they were defined by
humans and not mathematics.

Re: Radians Or Degrees?

<ur7jao$3t6eu$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33663&group=comp.lang.c#33663

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 13:48:08 +0000
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <ur7jao$3t6eu$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me>
<pan$d0f42$eeb000fb$9b95dafc$a5a80129@invalid.invalid>
<ur76he$3qbhl$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 13:48:08 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="581488e16e21ce826bd29e13c08fd0d8";
logging-data="4102622"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+YI+DOjJc73QlaS971PSG2BfryI0SFoko="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Sd3vXQ6qpLCtH1tNE6WZSf0R6mI=
Content-Language: en-GB
In-Reply-To: <ur76he$3qbhl$2@dont-email.me>
 by: Malcolm McLean - Thu, 22 Feb 2024 13:48 UTC

On 22/02/2024 10:09, David Brown wrote:
> On 22/02/2024 09:27, Blue-Maned_Hawk wrote:
>>
>> Radians is the only angle unit which is not arbitrary.
>>
>>
>
> No, it is not.  "Turns" are also not arbitrary, and are also
> mathematically fundamental.
>
> And while degrees were created by people, rather than something
> fundamental in the mathematics, the number of divisions was picked
> carefully for particular properties (lots of divisors).  And since
> degrees are a well-established and commonly known angle unit, using them
> is not arbitrary.  Even gradians were defined that way for good reasons.
>  So these units are not arbitrary - even though they were defined by
> humans and not mathematics.
>
We did have a lengthy and of course totally off topic discussion about
this over in comp.theory. I said that the Babylonians thought that
having 360 degrees was an inherent property of a circle, whilst others
said not.

--
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm

Re: Radians Or Degrees?

<87plwobmjm.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33664&group=comp.lang.c#33664

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.samoylyk.net!newsfeed.xs3.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 14:28:45 +0000
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <87plwobmjm.fsf@bsb.me.uk>
References: <ur5trn$3d64t$1@dont-email.me> <ur605r$3fe50$1@i2pn2.org>
<ur69i3$3ftgj$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="622cd877baa6337b8bb2a001e9f575d2";
logging-data="4120971"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193P4f/BzstuRuC/JUVcSRv8+7LHI4KGz4="
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:oRfzrYWDPhvM94/hl1vlpHGkY9E=
sha1:1wsAZ/DCB25XL5TGlZ9WYpN3DZY=
X-BSB-Auth: 1.7171169dd1bd9618e1cf.20240222142845GMT.87plwobmjm.fsf@bsb.me.uk
 by: Ben Bacarisse - Thu, 22 Feb 2024 14:28 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:

> On Thu, 22 Feb 2024 00:15:47 +0100, fir wrote:
>
>> if someone knows the reason why "6.28" radians are expected to better
>> than "1.0" 'circkles' in both mathemathics and assembly tell me - as i
>> dont know the reason
>
> It’s because trig calculations are most naturally done in radians. E.g.
> the approximation
>
> sin x ≅ tan x ≅ x as x → 0
>
> works only if x is in radians.

No, that applies to lots of angle measures. Radians are the natural
angle measure because we want sin' x = cos x and cos' x = -sin x. sin
and cos are the unique solution to that pair of differential equations
(with initial conditions sin 0 = 0 and cos 0 = 1).

> Also the Euler identity
>
> ix
> e = cos x + i sin x
>
> only holds if x is in radians. And so on and so on.

Yes, and there's another nod to the calculus here because just as sin an
cos are (with a minus sign) derivatives of each other, e^x is the
derivative of itself.

--
Ben.

Re: Radians Or Degrees?

<ur7p3f$3ues9$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33665&group=comp.lang.c#33665

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 16:26:39 +0100
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <ur7p3f$3ues9$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur605r$3fe50$1@i2pn2.org>
<ur69i3$3ftgj$2@dont-email.me> <87plwobmjm.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 15:26:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="662507d08800df18b137a15a3ff7b4f5";
logging-data="4144009"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LQy6s6E8adlARYI3rRMLWV+34Cp0VBpQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:rGEU3l38vtw2/ollLUrLkAEug9A=
In-Reply-To: <87plwobmjm.fsf@bsb.me.uk>
Content-Language: en-GB
 by: David Brown - Thu, 22 Feb 2024 15:26 UTC

On 22/02/2024 15:28, Ben Bacarisse wrote:
> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>
>> On Thu, 22 Feb 2024 00:15:47 +0100, fir wrote:
>>
>>> if someone knows the reason why "6.28" radians are expected to better
>>> than "1.0" 'circkles' in both mathemathics and assembly tell me - as i
>>> dont know the reason
>>
>> It’s because trig calculations are most naturally done in radians. E.g.
>> the approximation
>>
>> sin x ≅ tan x ≅ x as x → 0
>>
>> works only if x is in radians.
>
> No, that applies to lots of angle measures.

The Taylor expansion of sin x near 0 is x + O(x³), as is that of tan x.
So for any angle measure with a scale factor k (such as k = π/180 for
degrees), the Taylor expansions for sin(kx) and tan(kx) are both k.x +
O(x³).

Thus as x tends to 0, sin(kx) / tan(kx) tends to 1, but sin(kx)/x tends
to k. It only tends to 1 if k is 1, i.e., we are working in radians.

I don't think that this (that sin(x)/x tends to 1 as x tends to 0) is a
particularly good justification for using radians, however - the
calculus argument is much better IMHO.

Re: Radians Or Degrees?

<pan$5c05a$cb7911ea$a633ce06$f80aee8e@invalid.invalid>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33666&group=comp.lang.c#33666

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!bluemanedhawk.eternal-september.org!.POSTED!not-for-mail
From: bluemane...@invalid.invalid (Blue-Maned_Hawk)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 15:29:20 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <pan$5c05a$cb7911ea$a633ce06$f80aee8e@invalid.invalid>
References: <ur5trn$3d64t$1@dont-email.me>
<pan$d0f42$eeb000fb$9b95dafc$a5a80129@invalid.invalid>
<ur76he$3qbhl$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 15:29:20 -0000 (UTC)
Injection-Info: bluemanedhawk.eternal-september.org; posting-host="88d251291de5029efdde01ad7d49bf21";
logging-data="4145395"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ZUMUL3sxDNK4dfqDa1dTs5Wovm44yb+U="
User-Agent: Pan/0.154 (Izium; 517acf4)
Cancel-Lock: sha1:cJZwE3lxNwcqgLEy4bMjXgm7ySc=
X-Face: Llanfair­pwllgwyng
yll
­gogeryÂÃ
? ?­chwyrnÂÂÂÂÂÂ
­drobwll­llanÃ
‚Ã
ƒƒƒ‚­tysilioÂÂÂÃ
‚­gogo­goch
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACh0lEQVRYw71Z21bD
MAzzevbfkr4cHjrSXJyL044+MDa6WLEl2SkvkrZ1AbAvXO+bUGSCPYnsuIVGMpm
ZLnjX718GhAKNsp8lON2F9VrhELwIgJlBepkZjA78rVK+FkmNhEJK76UsJlz8+E
rJsjrpYouhLo/SC6qPHgakFOR8wV9+8rCfO/I/oVnmUZUp42/LW2XkLj9TCFNM9
jp5g2EmHZgpYZjCOkYU7sXVogRylJqpdggoFLG1g09Flah/7kErCxzR9HgXPYsq
0glb9cxjIz2Vsk9AmAoCSxECpD713joMKjQqLAtmMqJmXjdVvlMnMQCVITotJd1
z+fh1f1NNo+vuc1KnhWUmY7t03vydTud9BbXCtN3L2PL3bK7JCNG0GHzuZxafyB
fxevCxpm1vrwZltqw6SILCcdoCE6PGQC8wZWDA9Or7Qp5s3lAZezys0nDazs9S9
R0TjwEiksRxLkNPC1NMMWPs1bj0Ei0Yuo+JVtFLuzP1NRJ16qXWN8DhhtmS4PDg
O6mqRxs4bEJrYt087mSIow/1VzW2oFlMQuiuIy/KsUagvhdw6hSjJGlIavbLF8x
j3X47bccLcUSi0dkWh1nUZNhANT1tHKUXrNxNLbd9KPb9wDDVrKwmPQMOPQ1oy6
k5I1DwzDeRJd3jVIhDAUxq3ngzJG4CCkNXZxZVMcjefoK2J0gUY2S3rxz/RuTFx
2zHd9U+obimJXMG4edsk/2j5pTU5G1MmzbRLxkfq5EiT1GGsidvMGzi+1goGb2l
GCrN+nGnV8xj3q3JLRDVPL96vUc7Z4aJ3TN1mVqWAMJMfG+Jxh6TQqP+92iZkCU
xtglds1AB6r0aiSHKcnFck+p/c/0CbacFLQcajGcAAAAASUVORK5CYII=
 by: Blue-Maned_Hawk - Thu, 22 Feb 2024 15:29 UTC

David Brown wrote:

> On 22/02/2024 09:27, Blue-Maned_Hawk wrote:
>>
>> Radians is the only angle unit which is not arbitrary.
>>
>>
>>
> No, it is not. "Turns" are also not arbitrary, and are also
> mathematically fundamental.

That is a good point that i had not thought about. Thank you.

> And while degrees were created by people, rather than something
> fundamental in the mathematics, the number of divisions was picked
> carefully for particular properties (lots of divisors). And since
> degrees are a well-established and commonly known angle unit, using them
> is not arbitrary. Even gradians were defined that way for good reasons.
> So these units are not arbitrary - even though they were defined by
> humans and not mathematics.

I do not see how this is not still completely arbitrary.

--
Blue-Maned_Hawk│shortens to
Hawk│/
blu.mɛin.dÊ°ak/
│he/him/his/himself/Mr.
blue-maned_hawk.srht.site
foldable (once)

Re: Radians Or Degrees?

<20240222084826.921@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33667&group=comp.lang.c#33667

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 16:49:47 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <20240222084826.921@kylheku.com>
References: <ur5trn$3d64t$1@dont-email.me> <ur6sdt$3nqtd$1@dont-email.me>
Injection-Date: Thu, 22 Feb 2024 16:49:47 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d2c8fd2f8c1ca4503948abe9204aa03f";
logging-data="4176485"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19cMUE9UuFqTe7SrEAmzAoCuJPl8CJyZeY="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:clNftIvKgY6Vccs99D56NZON64s=
 by: Kaz Kylheku - Thu, 22 Feb 2024 16:49 UTC

On 2024-02-22, Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:
> On 21/02/2024 22:35, Lawrence D'Oliveiro wrote:
>> What units should be used for angles in trig functions?
>>
> The derivative of the sine is the cosine and vice versa, but only if you
> measure in radians.

Related to b^x being its own derivative w.r.t. x, only if b = e.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Radians Or Degrees?

<ur85o7$1aq8$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33669&group=comp.lang.c#33669

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 20:02:30 +0100
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <ur85o7$1aq8$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me>
<pan$d0f42$eeb000fb$9b95dafc$a5a80129@invalid.invalid>
<ur76he$3qbhl$2@dont-email.me>
<pan$5c05a$cb7911ea$a633ce06$f80aee8e@invalid.invalid>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 22 Feb 2024 19:02:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="25cbe9d9946826cc9af7371b141d0ade";
logging-data="43848"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+z7Sfps4XXEMlPVGnbsCbFuWkZysTYgwM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:3onF9mqtrCJyo46bOzRE18yttzo=
In-Reply-To: <pan$5c05a$cb7911ea$a633ce06$f80aee8e@invalid.invalid>
Content-Language: en-GB
 by: David Brown - Thu, 22 Feb 2024 19:02 UTC

On 22/02/2024 16:29, Blue-Maned_Hawk wrote:
> David Brown wrote:
>
>> On 22/02/2024 09:27, Blue-Maned_Hawk wrote:
>>>
>>> Radians is the only angle unit which is not arbitrary.
>>>
>>>
>>>
>> No, it is not. "Turns" are also not arbitrary, and are also
>> mathematically fundamental.
>
> That is a good point that i had not thought about. Thank you.
>
>> And while degrees were created by people, rather than something
>> fundamental in the mathematics, the number of divisions was picked
>> carefully for particular properties (lots of divisors). And since
>> degrees are a well-established and commonly known angle unit, using them
>> is not arbitrary. Even gradians were defined that way for good reasons.
>> So these units are not arbitrary - even though they were defined by
>> humans and not mathematics.
>
> I do not see how this is not still completely arbitrary.
>

"Arbitrary" means that you picked something without any particular
reason, and could just as well have picked something else. We use base
ten - that is not arbitrary, it is based on the number of fingers we
have. The Babylonians and Sumerians liked 5, 12 and 60 - also not
arbitrary, but picked as numbers with a lot of convenient factors. The
French revolutionists picked 400 for gradians, because 100 parts in a
right angle fit well with their new metric system, which fit well with
our standard number base. And one gradian of arc on a map corresponds
almost exactly to 100 km in distance - also very intentional, and not
arbitrary.

From a purely mathematical viewpoint, these units are arbitrary - but
from a human and historical viewpoint, they are not.

Re: Radians Or Degrees?

<ur86eg$1aip$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33670&group=comp.lang.c#33670

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: sgk...@REMOVEtroutmask.apl.washington.edu (Steven G. Kargl)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 19:14:24 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <ur86eg$1aip$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 19:14:24 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8979f066b84407740f1e160576e63f84";
logging-data="43609"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bs/ByOUOu7Pe/ViXRnZgD"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:KfPktEtML0Ur6Yf/w6oMaMP1KtU=
 by: Steven G. Kargl - Thu, 22 Feb 2024 19:14 UTC

On Thu, 22 Feb 2024 01:55:54 +0000, Lawrence D'Oliveiro wrote:

> On Thu, 22 Feb 2024 01:59:20 +0200, Michael S wrote:
>
>> The latest version of IEEE-754 Standard (or, may be, the one that is
>> still in preparation? I don't remember), specifiies additional set of
>> trig routines for which argument=1.0 corresponds to 180 degrees (pi
>> Radians). The names are SinPi, CosPi etc...
>> I find this choice somewhat less logical than 1.0 corresponding to 360
>> degrees, but that's a matter of personal taste.
>
> Also quite unnecessary to invent a whole set of parallel functions just
> for a different angle unit.

It depends on your numerical requirements. For single precision,
sinpi(1234.5) = 1 exactly. sin(3.1415926*1234.5) = sin(3878.2961) = 1
with an error of ULP = 0.0015 and FE_INEXACT raised.

If you're also trying to implement sinpi(x), sin(x), and sind(x)
over some extended domain such as x in [0,2^23], then argument
reduction for sinpi(x) and sind(x) are much easier than for
sin(x), but still require attention to detail.

--
steve

Re: Radians Or Degrees?

<ur87th$1rr1$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33671&group=comp.lang.c#33671

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 19:39:29 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <ur87th$1rr1$2@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me>
<pan$d0f42$eeb000fb$9b95dafc$a5a80129@invalid.invalid>
<ur76he$3qbhl$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 19:39:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0628152959bd9fc4f57a17e17cabba1f";
logging-data="61281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ltS5wSado5mmwfmpvQ1Zr"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:HyIPP5FmZqZKzicNuLuH2z2vAgI=
 by: Lawrence D'Oliv - Thu, 22 Feb 2024 19:39 UTC

On Thu, 22 Feb 2024 11:09:50 +0100, David Brown wrote:

> And while degrees were created by people, rather than something
> fundamental in the mathematics, the number of divisions was picked
> carefully for particular properties (lots of divisors).

I know base-360 is supposed to have come from the Babylonians. But
consider: you get exactly the same range of exact divisors (2, 3, 5, and
powers and products thereof) with base-30.

Re: Radians Or Degrees?

<ur886p$1rr1$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33672&group=comp.lang.c#33672

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 19:44:25 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <ur886p$1rr1$3@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me>
<pan$d0f42$eeb000fb$9b95dafc$a5a80129@invalid.invalid>
<ur76he$3qbhl$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 19:44:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0628152959bd9fc4f57a17e17cabba1f";
logging-data="61281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zGitqunLbJPGoDZRCgtSE"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:Nkrr1S4DjM5Dx4NeRUWv/Vp6Hro=
 by: Lawrence D'Oliv - Thu, 22 Feb 2024 19:44 UTC

On Thu, 22 Feb 2024 11:09:50 +0100, David Brown wrote:

> On 22/02/2024 09:27, Blue-Maned_Hawk wrote:
>>
>> Radians is the only angle unit which is not arbitrary.
>>
> No, it is not. "Turns" are also not arbitrary, and are also
> mathematically fundamental.

In maths, there are things that are “simple” and “natural”, or not
“arbitrary” or “fundamental”.

For example, the formula for centripetal acceleration can be expressed (a
= acceleration in ms¯², f = revolutions per second, r = radius in metres)
as

a = 4π²f²r

But if you express the rotational frequency in radians per second

ω = 2πf

then the formula becomes significantly simpler:

a = ω²r

Re: Radians Or Degrees?

<ur889a$1rr1$4@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33673&group=comp.lang.c#33673

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 19:45:46 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <ur889a$1rr1$4@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur605r$3fe50$1@i2pn2.org>
<ur69i3$3ftgj$2@dont-email.me> <87plwobmjm.fsf@bsb.me.uk>
<ur7p3f$3ues9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 19:45:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0628152959bd9fc4f57a17e17cabba1f";
logging-data="61281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18KT3L5Y5LB/qYEAD1eevOS"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:/Napt/b65lVVF9cbAcN/MExa3kA=
 by: Lawrence D'Oliv - Thu, 22 Feb 2024 19:45 UTC

On Thu, 22 Feb 2024 16:26:39 +0100, David Brown wrote:

> I don't think that this (that sin(x)/x tends to 1 as x tends to 0) is a
> particularly good justification for using radians, however - the
> calculus argument is much better IMHO.

These are just two among many examples of calculations being particularly
simple(r) in radians.

Re: Radians Or Degrees?

<ur88e4$1rr1$5@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33674&group=comp.lang.c#33674

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 19:48:20 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <ur88e4$1rr1$5@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 19:48:20 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0628152959bd9fc4f57a17e17cabba1f";
logging-data="61281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1801An5bWQ0F95ZHQaKbACZ"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:RqwyUSEXILvvfBpmvMn0hi0jDQg=
 by: Lawrence D'Oliv - Thu, 22 Feb 2024 19:48 UTC

On Thu, 22 Feb 2024 19:14:24 -0000 (UTC), Steven G. Kargl wrote:

> For single precision,
> sinpi(1234.5) = 1 exactly. sin(3.1415926*1234.5) = sin(3878.2961) = 1
> with an error of ULP = 0.0015 and FE_INEXACT raised.

That seems like a pretty arbitrary example with no earthly real-world use.

> If you're also trying to implement sinpi(x), sin(x), and sind(x)
> over some extended domain such as x in [0,2^23], then argument reduction
> for sinpi(x) and sind(x) are much easier than for sin(x), but still
> require attention to detail.

Doesn’t CORDIC take care of that?

Re: Radians Or Degrees?

<ur8a2p$2446$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33675&group=comp.lang.c#33675

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: sgk...@REMOVEtroutmask.apl.washington.edu (Steven G. Kargl)
Newsgroups: comp.lang.c
Subject: Re: Radians Or Degrees?
Date: Thu, 22 Feb 2024 20:16:25 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <ur8a2p$2446$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Feb 2024 20:16:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8979f066b84407740f1e160576e63f84";
logging-data="69766"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+61g2P0w3v5KCYMVj/mQoJ"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:iZlqzrJ98rAc7TT/OZWrj+llufI=
 by: Steven G. Kargl - Thu, 22 Feb 2024 20:16 UTC

On Thu, 22 Feb 2024 19:48:20 +0000, Lawrence D'Oliveiro wrote:

> On Thu, 22 Feb 2024 19:14:24 -0000 (UTC), Steven G. Kargl wrote:
>
>> For single precision,
>> sinpi(1234.5) = 1 exactly. sin(3.1415926*1234.5) = sin(3878.2961) = 1
>> with an error of ULP = 0.0015 and FE_INEXACT raised.
>
> That seems like a pretty arbitrary example with no earthly real-world use.

Apparently, you missed the part about argument reduction. For
sinpi(x), it is fairly easy to reduce x = n + r with n an integer
and r in [0,1). For the extended interval, x in [0,2^23], there
are roughly 2^23 values with r = 0.5; and thus, sinpi(x) = 1
exactly. There are no such values for sin(x), and argument reduction
for sin(x) is much more involved.

As to real-world use, how about any physical phenomena where one
is interest in resonance frequencies of the system. For a simple
example see https://www.feynmanlectures.caltech.edu/I_49.html
where one might write f(x) = sin(kx) = sin(pi * (2*x/L)) with
L a length of say a clamped string.

There are also uses with computing other functions, e.g., the
true gamma function via the Euler reflection formula.

gamma(x) * gamma(1 - x) = pi / sin(pi * x) = pi / sinpi(x)

>> If you're also trying to implement sinpi(x), sin(x), and sind(x)
>> over some extended domain such as x in [0,2^23], then argument reduction
>> for sinpi(x) and sind(x) are much easier than for sin(x), but still
>> require attention to detail.
>
> Doesn’t CORDIC take care of that?

What does google tell you?

--
steve

Pages:1234567
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor