comp.lang.ada
 help / color / mirror / Atom feed
From: hreba <f_hreba@yahoo.com.br>
Subject: Re: Many overlook the possibility sin(x,360.0) ?
Date: Mon, 1 May 2017 10:50:48 +0200
Date: 2017-05-01T10:50:48+02:00	[thread overview]
Message-ID: <emob79F7p89U1@mid.individual.net> (raw)
In-Reply-To: <3e7f9789-a0af-4342-a42e-46a6258d7801@googlegroups.com>

On 05/01/2017 07:22 AM, reinert wrote:
> Hi,
>
> Not a big philosophical question, but:
>
> I have often seen in (others) Ada code that many prefer to use for example sin(x) where they first calculate x := rad_per_degree*degrees.
>
> Why they do not use sin(degrees,360.0) if they need to use degree. Are there a good reason? Using sin(x, 3600.0) seems to keep the code simpler. Sometimes I even use sin(x,period).
>
> reinert
>

For calculations inside a program, using the same unit all over is 
simpler, because you don't have to do any conversion again and again. 
Isn't a function with one parameter simpler than one with two, which 
would execute such a conversion at each call? So one would use meters 
(just an example) for all lengths inside a program, and convert them to 
other units (e.g. micrometers) only at the interface with humans, when 
necessary.

If one unit has an advantage over all others, such as radians have for 
the numerical calculation of trigonometric functions, you use that one, 
internally.
-- 
Frank Hrebabetzky		+49 / 6355 / 989 5070


  reply	other threads:[~2017-05-01  8:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-01  5:22 Many overlook the possibility sin(x,360.0) ? reinert
2017-05-01  8:50 ` hreba [this message]
2017-05-01 17:46 ` Nasser M. Abbasi
2017-05-01 20:04   ` Dmitry A. Kazakov
2017-05-01 20:46     ` Shark8
2017-05-02  6:37       ` reinert
2017-05-02  8:35         ` Dmitry A. Kazakov
2017-05-03  4:12           ` reinert
2017-05-03  7:18             ` Dmitry A. Kazakov
2017-05-08 17:37               ` reinert
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox