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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5f5a48f21d7f7525 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!b4g2000pra.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Inferring array index type from array object Date: Tue, 29 Jun 2010 13:22:55 -0700 (PDT) Organization: http://groups.google.com Message-ID: <73a0af1d-7213-44af-90fa-ed6de4c64ce8@b4g2000pra.googlegroups.com> References: <6b20ed09-efc1-4df7-90f9-5e141482e8d0@d37g2000yqm.googlegroups.com> <1305oqccr1h2t$.x33x4oxwd84d$.dlg@40tude.net> <88ec2vF3uqU1@mid.individual.net> <88f9osFmcmU1@mid.individual.net> <88sld2F9m8U1@mid.individual.net> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1277842975 11269 127.0.0.1 (29 Jun 2010 20:22:55 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 29 Jun 2010 20:22:55 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b4g2000pra.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:12967 Date: 2010-06-29T13:22:55-07:00 List-Id: On Jun 29, 12:31=A0pm, Warren wrote: > > > So, what is the "missing" function? > > > > > 1) The "inverse" of a complex number. Isn't that just 1.0 / X? The division operator is defined in Generic_Complex_Types and Complex_Types (G.1.1), and there is a definition with a real left operand and complex right operand. If there's a different kind of inverse, I'm not familiar with it. If this is the same thing you're looking for, however, I don't see any gain in providing a separate "Inverse" function. 1.0/X or X**(-1) are readable enough for me. > 2) Also, math libraries usually include atan2(y,x), > since the error can be large with certain ranges > of x in the tan(x) form: As Jeffrey pointed out, Ada does have that. Since Ada allows overloaded function names, we can still call it Arctan instead of having to invent a name like atan2 (or three names as they do in C). By the way, I'm not sure that the error is the main reason for having this function. The result of the two-argument arctan function is in the range -pi .. +pi, as opposed to -pi/2 .. +pi/2 for the one- argument variation; this allows you to get a result in any of the four quadrants (instead of just two), giving you the correct result when you want to compute the angle corresponding to a point (x, y) on a Cartesian graph. -- Adam > #include > > double atan2(double y, double x); > float atan2f(float y, float x); > long double atan2l(long double y, long double x); > > Warren