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,UTF8 Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!usenet-fr.net!gegeweb.org!aioe.org!not-for-mail From: "John B. Matthews" Newsgroups: comp.lang.ada Subject: Re: Inferring array index type from array object Date: Tue, 29 Jun 2010 17:47:58 -0400 Organization: The Wasteland Message-ID: 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> <73a0af1d-7213-44af-90fa-ed6de4c64ce8@b4g2000pra.googlegroups.com> NNTP-Posting-Host: LQJtZWzu+iKlBROuDg+IUg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: g2news2.google.com comp.lang.ada:12977 Date: 2010-06-29T17:47:58-04:00 List-Id: In article , Warren wrote: > Warren expounded in news:Xns9DA6AC2A2C8BWarrensBlatherings@81.169.183.62: > > > Adam Beneschan expounded in news:73a0af1d-7213-44af-90fa-ed6de4c64ce8 > > @b4g2000pra.googlegroups.com: > > > >> On Jun 29, 12:31 pm, Warren wrote: > >>> > >>> > So, what is the "missing" function? > >>> > >>> > > >>> > >>> 1) The "inverse" of a complex number. > >> > >> Isn't that just 1.0 / X? > > > > Ok, it seems to be, as the GSL (Gnu Scientific Library) > > defines it as: > > > > gsl_complex > > gsl_complex_inverse (gsl_complex a) > > { /* z=1/a */ > > double s = 1.0 / gsl_complex_abs (a); > > > > gsl_complex z; > > GSL_SET_COMPLEX ( > > &z, (GSL_REAL (a) * s) * s, -(GSL_IMAG (a) * s) * s); > > return z; > > } > > Apologies for following up my own post, but > looking at the GSL implementation of complex > division: > [...] > Given a=1.0, the inverse function is definitely > higher performance. It's simpler calculation > probably implies more accuracy as well. The more comparable Ada implementation (from GNAT) would be function "/" (Left : Real'Base; Right : Complex) return Complex is a : constant R := Left; c : constant R := Right.Re; d : constant R := Right.Im; begin return Complex'(Re => (a * c) / (c ** 2 + d ** 2), Im => -((a * d) / (c ** 2 + d ** 2))); end "/"; -- John B. Matthews trashgod at gmail dot com