From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.unit0.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: hreba Newsgroups: comp.lang.ada Subject: Re: Many overlook the possibility sin(x,360.0) ? Date: Mon, 1 May 2017 10:50:48 +0200 Message-ID: References: <3e7f9789-a0af-4342-a42e-46a6258d7801@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net rDtROy2xpIdiqDGpJmbAgAsN3kNI8iR3TyH0AJc/k29EB2p4CJ Cancel-Lock: sha1:mUNilXkcY5ws5oHsgGXUNTRpIjY= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: <3e7f9789-a0af-4342-a42e-46a6258d7801@googlegroups.com> Xref: news.eternal-september.org comp.lang.ada:46649 Date: 2017-05-01T10:50:48+02:00 List-Id: 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