X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Message-ID: <539319.41328.qm@web25002.mail.ukl.yahoo.com> Date: Wed, 1 Apr 2009 17:04:42 +0000 (GMT) From: Marco Atzeri Subject: Re: complex number To: cygwin AT cygwin DOT com, Greg Chicares MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 --- Mer 1/4/09, Greg Chicares ha scritto: > Da: Greg Chicares=20 > Oggetto: Re: complex number > A: cygwin AT cygwin DOT com > Data: Mercoled=EC 1 Aprile 2009, 17:32 > On 2009-04-01 14:48Z, Marco Atzeri > wrote: > > > > I was trying to understand why this code > >=20 > > #include > > #include > >=20 > > int main() > > { > >=A0=A0=A0double a =3D 0; > >=A0=A0=A0double b =3D 1. / a; > >=A0=A0=A0a +=3D 1; > >=A0=A0=A0std::cout << std::abs > (std::complex (b, a)) << '\n'; > >=A0 } > >=20 > > produce Inf on most platform and NaN on cygwin. >=20 > As I read C++2003 26.2/3, this use of std::abs has > undefined > behavior, so NaN would be conforming even though Inf would > be less surprising. >=20 >=20 you could be right but, I expect that gcc-4.3.2 work=20 in similar way in linux and cygwin, so a call to cabs. In newlib cabs is wrapper for hypot and=20 hypot (0, Inf) gives Inf=20 Regards Marco -- 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/