X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 1 Apr 2009 17:22:56 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: complex number Message-ID: <20090401152256.GO12738@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <432458 DOT 55204 DOT qm AT web25004 DOT mail DOT ukl DOT yahoo DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <432458.55204.qm@web25004.mail.ukl.yahoo.com> User-Agent: Mutt/1.5.19 (2009-02-20) 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 Apr 1 14:48, Marco Atzeri wrote: > > Dear All, > I was trying to understand why this code > > #include > #include > > int main() > { > double a = 0; > double b = 1. / a; > a += 1; > std::cout << std::abs (std::complex (b, a)) << '\n'; > } > > produce Inf on most platform and NaN on cygwin. That's the result of the newlib function which is defined as double cabs(z) struct complex z; { return hypot(z.x, z.y); } > I found that newlib have the function cabs (complex absolute) > but in cygwin the prototypes is > > extern double cabs(); The math.h header is from newlib as well. I don't know why the math.h header is missing a normal prototype. I *assume* that nobody ever made the effort to convert these old functions (cabs is from 1994) to the ANSI C style. You should ask this question on the newlib list. > so just a placeholder but not a useful function. > There is any reason why cygwin is missing functional > C99 complex functions ? Sorry, it's all about newlib. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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/