delorie.com/archives/browse.cgi | search |
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: | <f60fe000904011147n7161071ey38a37f4f71499aa@mail.gmail.com> |
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> <f60fe000904011147n7161071ey38a37f4f71499aa AT mail DOT gmail DOT com> |
Date: | Wed, 1 Apr 2009 14:47:55 -0400 |
Message-ID: | <f60fe000904011147q55181211o6230d1deb626c5c7@mail.gmail.com> |
Subject: | Fwd: complex number |
From: | "Mark J. Reed" <markjreed AT gmail DOT com> |
To: | cygwin AT cygwin DOT com |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
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 <markjreed AT gmail DOT com> -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |