X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_51,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: References: <8704 DOT 38224 DOT qm AT web25004 DOT mail DOT ukl DOT yahoo DOT com> <20090401173054 DOT GA10205 AT calimero DOT vinschen DOT de> Date: Wed, 1 Apr 2009 14:47:55 -0400 Message-ID: Subject: Fwd: complex number From: "Mark J. Reed" To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Wed, Apr 1, 2009 at 1:30 PM, Corinna Vinschen wrote: > > > > That's the result of the newlib function which is defined > > > as > > > > > > =C2=A0 double > > > =C2=A0 cabs(z) > > > =C2=A0 struct complex z; > > > =C2=A0 { > > > =C2=A0 =C2=A0 return hypot(z.x, z.y); > > > =C2=A0 } > > > That's from the newlib source code, I assume? While the function cabs() exists inside newlib, and is declared as an extern in math.h, it's not documented, nor is there a prototype for it or a declaration of "struct complex" that I can find anywhere in the installed headers (just the "complex" typedef in the gcc headers, whose structure doesn't match the above).=C2=A0 l Yet somehow the compiler is doing some sort of typechecking anyway and rejecting everything I try to pass as a parameter, so I can't validate the return value of cabs. Did you determine that the C++ std::complex::abs() method winds up calling cabs() eventually, or was that a guess?=C2=A0 It's strange, because calling hypot(a, b) directly yields the correct result. -- Mark J. Reed -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/