X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: sourceware.org Message-ID: <49D38910.5020600@sbcglobal.net> Date: Wed, 01 Apr 2009 15:32:32 +0000 From: Greg Chicares User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: complex number References: <432458 DOT 55204 DOT qm AT web25004 DOT mail DOT ukl DOT yahoo DOT com> In-Reply-To: <432458.55204.qm@web25004.mail.ukl.yahoo.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 On 2009-04-01 14:48Z, Marco Atzeri wrote: > > 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. 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. -- 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/