delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Spam-Check-By: | sourceware.org |
Date: | Wed, 1 Apr 2009 19:30:54 +0200 |
From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: complex number |
Message-ID: | <20090401173054.GA10205@calimero.vinschen.de> |
Reply-To: | cygwin AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
References: | <8704 DOT 38224 DOT qm AT web25004 DOT mail DOT ukl DOT yahoo DOT com> |
MIME-Version: | 1.0 |
In-Reply-To: | <8704.38224.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 |
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 Apr 1 16:58, Marco Atzeri wrote: > --- Mer 1/4/09, Corinna Vinschen ha scritto: > > > I was trying to understand why this code > > > > > > #include <iostream> > > > #include <complex> > > > > > > int main() > > > { > > > double a = 0; > > > double b = 1. / a; > > > a += 1; > > > std::cout << std::abs > > (std::complex<double> (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); > > } > > > > Hi Corinna, > that is not correct as hypot( 0, Inf) > return Inf and not NaN. > > There is a cabs backup implementation in libgcc that is probably > the one used when system cabs is not available. But cabs *is* exported by Cygwin and the function is the newlib function. I can't tell you why you see what you see. I'm not on good terms with this complex math thingy. That's why I think you should really discuss this on the newlib list :} 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |